sql-serverspatialesrishapefilemanifold

SQL Server Spatial Datatypes


I have exported an ESRI shapefile to SQL Server 2008 using Manifold, which gives me a column "Shape" of type Geometry. The Manifold .prj file looks like this

GEOGCS["GCS_WGS_1984",DATUM["D_WGS_1984",SPHEROID["WGS_1984",6378137,298.257223563]],
PRIMEM["Greenwich",0],UNIT["Degree",0.017453292519943295]]

so I assume the SRID is 4326? However when I run this query I expect it to return United States, but I don't get any rows:

DECLARE @lat float
DECLARE @long float
DECLARE @g geometry

SET @lat = 40.0
SET @long = -90.0
SET @g = geometry::Point(@lat,@long,4326);

SELECT * FROM Countries WHERE Shape.STContains(@g) = 1;

I have tested some other queries which works so I guess the SRID is wrong? If that should be that case, how do I get the correct?


Solution

  • Problem solved: The correct order of arguments is geometry::Point(long,lat,SRID). I though it would be lat,long,SRID ..