geography

How to “average” two or more geography linestrings using C#/SQL Server 2008 spatial

大憨熊 提交于 2020-01-03 17:01:20
问题 Suppose I've got a set of results from a study into the behaviour of a particular migratory bird. The bird has been tagged, and a GPS receiver records the migration path it follows each year over a five year period. The results are stored in a SQL Server table that contains one geography linestring for each year's path. How would you go about defining the linestring representing the "average" path followed over the five year period? Note that each sample linestring may contain a different

Fine-tuning a geospatial index

时间秒杀一切 提交于 2020-01-03 04:25:23
问题 I just converted my SQL Server 2008 database from using a lat/long pair to using the new geography type. I run queries on businesses that are within 30 miles of a geography::Point, using the STDistance function, like so: WHERE this_.GeoLocation.STDistance(geography::Point(42.738963, -84.5522, 4326)) <= 48280.32 Here is the index that I have on the geography column: CREATE SPATIAL INDEX IDX_Business_GeoLocation ON Business (GeoLocation) USING GEOGRAPHY_GRID WITH ( GRIDS = ( LEVEL_1 = LOW,

Sql 2008 query problem - which LatLong's exists in a geography polygon?

橙三吉。 提交于 2020-01-01 11:49:57
问题 i have the following two tables:- GeoShapes GeoShapeId INT IDENTITY Name VARCHAR(100) ShapeFile GEOGRAPHY [ this is a closed Polygon of Lat/Longs ] CrimeLocations CrimeLocationId INT IDENTITY LatLong GEOGRAPHY [ this is a Lat/Long Point ] Now, i have around 10K GeoShape results and around 500CrimeLocations. I'm trying to figure out which GeoShapes all 500 crime lat/long points exist inside of. :( I just don't get it! I was trying to do an STIntersects on a subquery but that didn't work. Any

Selecting geographical points within area

时光怂恿深爱的人放手 提交于 2019-12-31 02:50:08
问题 I have a SQL Server 2008 table with a column of the geography datatype. The value is a point (latitude and longitude). How do I query the table to return all rows where the location is within a 10 kilometer radius of a given coordinate? 回答1: You probably want the STDistance method: http://msdn.microsoft.com/en-us/library/bb933952.aspx Or the STWithin method: http://msdn.microsoft.com/en-us/library/bb933991.aspx 回答2: This query eventually solved my problem: DECLARE @geoMyPoint geography SET

Having a generic GEOGRAPHY column with PostGIS

时光毁灭记忆、已成空白 提交于 2019-12-23 13:06:18
问题 In PostgreSQL 9 + PostGIS 1.5, is there a way to create a "generic" GEOGRAPHY column? By that I mean a column that would accept POINTs as well as POLYGONs, LINESTRINGs, etc. Until now, I've only seen columns like GEOGRAPHY(POINT,4326) on the Internet. If that is not possible, then how would you design (from a DB point of view) an entity that is linked to a random geographical object (point, polygon, whatever)? Should I create 3, 4, 5 different tables for each type of geographical object I'd

Database of US metropolitan area names?

假装没事ソ 提交于 2019-12-23 08:23:22
问题 I've been unsuccessful in trying to find a US metropolitan area (e.x. San Francisco Bay Area, South Bay, The Berkshires, Upstate New York, etc.) database that is defined by cities. Does anyone know if such a thing exists? Wikipedia has a list of "Intrastate Regions" here: http://en.wikipedia.org/w/index.php?title=List_of_regions_of_the_United_States#Intrastate_regions Except it would be a pain going through each 50 states, and then pulling out the area's article to find what cities said area

Cities to Metropolitan areas

老子叫甜甜 提交于 2019-12-23 03:42:13
问题 I have a database of cities (in both the US and the rest of the world). The database entries are simple text strings. Currently the database contains even small cities (population 10,000). I wish to use a larger scale database instead, by assigning the cities into larger geographical\metropolitan areas. An example can be the Metropolitan areas in Google's AdWords API: http://code.google.com/intl/iw-IL/apis/adwords/docs/developer/adwords_api_us_metros.html but I have no problem using other

How to define 'geography' type using Npgsql and OrmLite (using postgresql, postgis, c#)

╄→гoц情女王★ 提交于 2019-12-21 12:03:03
问题 How do I define a postgis 'geography' type in my C# class model so that OrmLite can easily pass it through to Postgresql so I can run spatial queries in addition to saving spatial data to the 'geography' column? 回答1: The best library is NetTopologySuite for this case; you can use like this; protected GisSharpBlog.NetTopologySuite.Geometries.Geometry _geom; public GisSharpBlog.NetTopologySuite.Geometries.Geometry Geom { get { return _geom; } set { _geom = value; } } protected string _geomwkt;

How to correct Polygon Ring Orientation using C# Entity Framework 5 DbGeography Spatial Data

佐手、 提交于 2019-12-21 04:39:09
问题 I'm working with the new Entity-Framework 5 using the Spatial data type DbGeography as part of my model for storing in one instance, a POINT and in another instance a POLYGON. When setting the value of my POLYGON all saves with no error however this is only the case if I draw the Polygon on the map in a clockwise order. If I draw the POLGON in an anti-clockwise direction I get an error the the sql level indicating that the data is an invalid geography type. Now after doing my own research

SQL Server 2008 R2 Geography Distance?

二次信任 提交于 2019-12-21 04:19:19
问题 I have created a table with the following columns: Text:varchar(255) Location:geography They contain a few city's from The Netherlands as data (got the coordinates from google maps): Rotterdam - POINT (51.925637 4.493408 4326) Utrecht - POINT (52.055868 5.103149 4326) Nijmegen - POINT (51.801822 5.828247 4326) Breda - POINT (51.542919 4.77356 4326) I want to know the distance between all city's in the DB from Rotterdam, so I perform this query: Select Text, Location, Location.STDistance