This project is read-only.

spatial indexes and distance_spheroid

Topics: Developer Forum, User Forum
Nov 6, 2008 at 4:03 AM
I downloaded this library earlier today and have two questions.

1. Can I create spatial indexes on the geometries I create?

2. Can I search for the distance between points on a sphere?  In postgis I can do this using ST_distance_spheroid.  I only see a ST.distance function. 

Also, how active is this project?  Is anyone using this in a large production environment?

Thanks.
Nov 6, 2008 at 10:24 AM
Hi troyounces,
1 There are no spatial indexes as such in mssqlspatial, instead each geometry column has a set of associated envelope columns which are used as a pre filter before any spatial operation. If you wanted to add support for such you may find some useful information here http://www.codeplex.com/SpatialIndexing 
2 Not as far as I am aware because ST.Distance returns a value in the same units as the projection in which the geometry exists. MsSqlSpatial is effectively an sql interface to NetTopologySuite, Proj.Net and GeoAPI.Net, and I dont believe that functionality exists within them,  however you may be able to simulate the functionality by creating a linestring with points ST.Distance apart and then reprojecting that onto a plane.

At present, I am concentrating more on SharpMap v2 but I do occasionally try to update the V2 dev branch here to reflect changes in the V2 versions of SharpMap , NTS, Proj.Net and GeoAPI. There are outstanding issues with the V2 Branch of MsSqlSpatial particularly with large datasets, V1.7.x and trunk do not have the same issues so for the time being I would choose to use one of them for production.

We do use MsSqlSpatial in large production apps, but we are also using the native spatial features in SqlServer 2008 as well which may be a better starting point if you have access to it. hth jd
Nov 6, 2008 at 2:58 PM
Thanks for the quick reply John.

What I want to do is add a few hundred thousand addresses into a database - I have the latitude and longitudes from a postal code file.  I want to pick a point (lat. long) and find all matching points within a certain radius.  Can I do this using this library?
Nov 6, 2008 at 3:58 PM
Edited Nov 6, 2008 at 4:06 PM
Hi again, I think you can do this, but you would search using an angle rather than a linear distance
eg ST.IsWithinDistanceQuery(tableName, columnName, startPointWkbBytes, queryAngle). You may like to check out the Geography data type in Sql Server 2008 as they are designed for storing spherical coordinates.