Geography Type and Geospatial Search

240 views
Skip to first unread message

Simon Farrell

unread,
Aug 5, 2012, 8:40:39 AM8/5/12
to servic...@googlegroups.com
Hi,

I'm currently implementing a ServiceStack restful API using ORMLite with SQL Server.  I'm tracking items that have a location and I'm not sure exactly the best way to store the data and perform a geospatial search (i.e Items near you) 

  1. Should I use the SQL Server Geography type or two fields (Lat Long) as (decimal (9,6))?  Will ORMLite map these field types?
  2. Any advice on the best way to do the GeoSpatial search? Should I write a stored proc and exec, or is there a way to do this through LINQ?
Thanks in advance!

PS:  I'm not bound to SQL Server, I'd be happy to use PostgreSQL if it's the better option.

Cheers,

Simon


Demis Bellot

unread,
Aug 5, 2012, 10:17:25 PM8/5/12
to servic...@googlegroups.com
Hey Simon,

We use `Decimal(9,6)` DataType in SqlServer to hold our Lat/Long points and LatSW/LonSW/LatNE/LonNE bounding box whenever we need it in StackOverflow Careers.
We map these back to C# decimal data types.

Note: You will likely get more detailed responses from StackOverflow which is now the place to ask ServiceStack-related questions.

Cheers,

Simon Farrell

unread,
Aug 6, 2012, 11:48:27 PM8/6/12
to servic...@googlegroups.com
Thanks Demis.  I'll change to using Decimal(9,6) and the bounding box algorithm.

Jay

unread,
Jun 27, 2013, 9:30:25 AM6/27/13
to servic...@googlegroups.com
Hi Demis,

Doesn't ServiceStack.OrmLite provide a nice way to save geographic data types in classes for easy insert into the geography data type in the database?

(I'm playing with Sql server and Postgresql+postgis in order to work out easiest option as I just want to declare the datatype and run geo queries and save geo data using ServiceStack - is it missing functionality?)

p.s. great work on service stack btw

Demis Bellot

unread,
Jun 27, 2013, 11:34:24 AM6/27/13
to servic...@googlegroups.com
It doesn't include any specific support for db-specific Geo types.
It just tries to map db values to C# fields on POCOs.



--
You received this message because you are subscribed to the Google Groups "ServiceStack .NET Open Source REST Web Services Framework" group.
To unsubscribe from this group and stop receiving emails from it, send an email to servicestack...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 
Reply all
Reply to author
Forward
0 new messages