geography

How to calculate distance between multiple points in SQL Server?

时间秒杀一切 提交于 2019-12-18 15:48:24
问题 I have table with data from GPS, e.g.: Latitude , Longitude , Time , UserId How to aggregate total distance in specified time frame summing all distances by all points (ordered by time) and group data by user? Thanks 回答1: If you are using SQL Server, you might be interested in using the geography data type so you can request the database using the dedicated method and geographical index. The geography data type is available since SQL Server 2008, you can more information right here: http:/

Finding a geography point within a range of another - SQL Server

白昼怎懂夜的黑 提交于 2019-12-18 12:38:43
问题 I have a table in SQL Server that has geography datatype column in it. I want to query this table to find rows that fall near (within a range) of another given geography point. Does anyone have any ideas as to the best way to do this? I have 2 options of where to do this type of query. I can write it on the sql server as a stored proc or I can do it in c# code as I am using the Entity Framework for data access. I would have a query that has a range (eg 100m) and a geography point passed in to

Clustering Lat/Longs in a Database

☆樱花仙子☆ 提交于 2019-12-18 10:29:40
问题 I'm trying to see if anyone knows how to cluster some Lat/Long results, using a database, to reduce the number of results sent over the wire to the application. There are a number of resources about how to cluster, either on the client side OR in the server (application) side .. but not in the database side :( This is a similar question, asked by a fellow S.O. member. The solutions are server side based (ie. C# code behind). Has anyone had any luck or experience with solving this, but in a

Calculating Distance Between 2 Cities [closed]

徘徊边缘 提交于 2019-12-18 10:24:25
问题 Closed . This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post. Closed 5 years ago . How do you calculate the distance between 2 cities? 回答1: If you need to take the curvature of the earth into account, the Great-Circle distance is what you're looking for. The Wikipedia article probably does a better job of explaining how the formula works than me, and there's

Calculating area enclosed by arbitrary polygon on Earth's surface

二次信任 提交于 2019-12-17 02:35:15
问题 Say I have an arbitrary set of latitude and longitude pairs representing points on some simple, closed curve. In Cartesian space I could easily calculate the area enclosed by such a curve using Green's Theorem. What is the analogous approach to calculating the area on the surface of a sphere? I guess what I am after is (even some approximation of) the algorithm behind Matlab's areaint function. 回答1: There several ways to do this. 1) Integrate the contributions from latitudinal strips. Here

Grouping geographical shapes

五迷三道 提交于 2019-12-13 11:39:43
问题 I am using Dundas Maps and attempting to draw a map of the world where countries are grouped into regions that are specific to a business implementation. I have shape data (points and segments) for each country in the world. I can combine countries into regions by adding all points and segments for countries within a region to a new region shape. foreach(var region in GetAllRegions()){ var regionShape = new Shape { Name = region.Name }; foreach(var country in GetCountriesInRegion(region.Id)){

How can I extract x, y and z coordinates from geographical data by Python?

≡放荡痞女 提交于 2019-12-13 05:36:12
问题 I have geographical data which has 14 variables. The data is in the following format: QUADNAME: rockport_colony_SD RESOLUTION: 10 ULLAT: 43.625 ULLON: -97.87527466 LRLAT: 43.5 LRLON: -97.75027466 HDATUM: 27 ZMIN: 361.58401489 ZMAX: 413.38400269 ZMEAN: 396.1293335 ZSIGMA: 12.36359215 PMETHOD: 5 QUADDATE: 20001001 The whole data has many previous variables in the sequence. How can I extract the coordinates ULLAT, ULLON and LRLAT from the data into three lists, so that the each row corresponds

Best way to export/import MS Sql 2008 Geography data

我与影子孤独终老i 提交于 2019-12-12 09:37:51
问题 (ANSWER) How to export some Geography data from a Microsoft Sql Server 2008. You'll need to use the command line argument BCP to dump the data in it's original (native) format to a binary file. Then on the other server you can bulk insert this binary data back into a table of the same strucutre. here's some code. Export Command Line: bcp "geodata.dbo.GeographyData" out "C:\GeoData.bin" -T -n -S <servername> Notes This uses a Trusted connection use the bcp /? for more help for your export

'The specified input does not represent a valid geography instance' exception when using SqlGeographyBuilder

心已入冬 提交于 2019-12-12 07:20:02
问题 I've written a small application that reads in from a series of KML files and then converts them into the Microsoft.SqlServer.Types.SqlGeography type using the following code: private SqlGeography CreateGeographyFromKML( string kml, bool debug ) { // use SqlGeographyBuilder to help create the SqlGeography type var geographyBuilder = new SqlGeographyBuilder(); // Get co-ordinates var xml = XDocument.Parse(kml); var df = xml.Root.Name.Namespace; XElement coordinates = xml.Descendants(df +

One of the identified items was in an invalid format - Microsoft.SqlServer.Type

我们两清 提交于 2019-12-12 06:36:27
问题 I'm trying to retrieve geography data from my SQl Server 2012 DB with: new SqlDataAdapter("SELECT [SpatialColumn] FROM [SpatialTable]", myConnection).Fill(myDatatable); When the data is a Sql Server 2008 geography type such as Polygon , it's all working fine. But when the type is the new CurvePolygon then that line of code crashes with the error: System.FormatException occurred Message="One of the identified items was in an invalid format." Source="Microsoft.SqlServer.Types" StackTrace: at