Questions tagged [sqlgeography]

The MS SQL Server SqlGeography type represents data in a geodetic (round earth) coordinate system.

264 questions
1
vote
1 answer

Distance difference in SQL - why so big discrepancy?

I use 2 ways if calculating distance between coordinates, difference between them is quite big (more than 400 m). Do you know why? And which one of all ways of calculating is the most accurate? 1st: DECLARE @source geography =…
Muska
  • 283
  • 4
  • 15
1
vote
0 answers

Cross Join with STDistance take too long

Rarely in my SQL SERVER 2016 environment I need to get the distance between Geography data from two different tables like I show below CREATE TABLE #Geos1 (GeoPoint GEOGRAPHY) INSERT INTO #Geos1 SELECT TOP 2000 Geo FROM MyTable1 ORDER BY Id…
DrPyro
  • 11
  • 2
1
vote
0 answers

Adding Unique Constraint to Geography Type

I'm just getting into Postgis and I'm running into an interesting problem: I've added a unique constraint to my table between a varchar name column with a generic geography geom column: CREATE TABLE public.locations ( id uuid NOT NULL, name…
Allen
  • 794
  • 1
  • 6
  • 19
1
vote
1 answer

SQL Server Geography data type and distances between all combinations of points

I'm new to SQL Server's capabilities regarding the Geography data type and how it can be used to calculate distances between two points. However, with the help of a good YouTube video, I was able to quickly write a query to find all the rows in a…
PongGod
  • 829
  • 1
  • 11
  • 19
1
vote
1 answer

How to insert geography data to SQL Server with Python jaydebiapi cursor.executemany()?

I did insert data into SQL Server using cursor.execute(). Here is my code snippet: insert_str = """INSERT INTO [test].[DBO].[SPATIAL] VALUES({},{});""" geography = "geography::STGeomFromText('LINESTRING(-95.323167 29.985500, -95.323333 29.985500)',…
han
  • 103
  • 7
1
vote
0 answers

Polygon to line string coverage path

I hope that this is not the wrong place for my question, however, when I don't have anywhere else to go, SO never lets me down. I am looking for a way to convert any given polygon on a map, to a serpentine line string. I would like to pass the…
Joachim Prinsloo
  • 618
  • 3
  • 12
  • 31
1
vote
0 answers

How to parse multiple geojson feature types and write to SQL Geography column

This is the follow up question from here. Given: A geojson file with 3 different geometry types (Point, Polygon, Line) and multiple properties (AssetType, GeoID, etc.), write each geometry type and its corresponding properties to a single Azure SQL…
SeaDude
  • 3,725
  • 6
  • 31
  • 68
1
vote
0 answers

How can I adapt my radius search by postcode/zipcode to radius search by town?

We currently have a working script to return a list of all our products within a radius of a postcode/zipcode. It searches for all products that have locations in area codes within the @miles parameter of @lookingfor postcode, also returning the…
cloudsafe
  • 2,444
  • 1
  • 8
  • 24
1
vote
1 answer

Did you manage to run STBuffer on MULTIPOLYGONS ? With SQL Server?

In SQL Server geo-spatial I can't run a STBuffer for MULTIPOLYGONS. DECLARE @g geography = geography::STMPolyFromText('MULTIPOLYGON(((1 1, 1 -1, -1 -1, -1 1, 1 1)),((1 1, 3 1, 3 3, 1 1)))', 4326); SELECT @g -- no problem to run SELECT…
Zax
  • 33
  • 3
1
vote
0 answers

ASP.NET API Exception after using ServiceStack.OrmLite.SqlServer.Converters

I wanna use SqlGeography for its benefits in sql server 2016 and I have Visual Studio 2017 while using servicestack 4.5.14 and ormlite. First and foremost I want to have SqlGeography as data type for my locations but it generates many exception as…
1
vote
1 answer

Calculating pairwise routing distances between a large number of GPS coordinates

I have a web application where each user also has GPS coordinates (SqlGeography). As of now, I calculate the distance between two GPS coordinates as Euclidean distance with the Distance function. Some users have requested that I replace the…
citronas
  • 19,035
  • 27
  • 96
  • 164
1
vote
1 answer

Which is more efficient, Geography vs. float type in SQL Server for selecting/inserting locations?

What is the performance impact in storing a location as a Geography type vs. simply saving the longitude and latitude as one float each?
Markus
  • 1,020
  • 14
  • 18
1
vote
1 answer

Divide table into chunks with table data to process them in SQL Server

I hope you guys can help me or at least point me in the right direction. I have a SQL Server table that represent the boundaries of a Polygon. It roughly looks like this in a simplified…
l_degaray
  • 63
  • 9
1
vote
1 answer

System.Data.Entity.Spatial.DbGeography - No Parameterless Constructor

I have a submission page where one of the form's fields are lat/long coordinates. I store them in a System.Data.Entity.Spatial.DbGeography called 'Location', and render the fields like this:
@Html.LabelFor(model…
oussama_tr
  • 61
  • 7
1
vote
1 answer

Submit a dbgeography form

I have a problem when submitting the form for a new creation, the problem that I can not validate the data of variable dbgeometry .. the error message is "No constructor without parameter defined for this object." this is my code controller : …