Querying Spatial Types/ POI's around a certain POI

Posts   
 
    
zoinky
User
Posts: 5
Joined: 03-Jul-2009
# Posted on: 16-Feb-2012 17:05:50   

Usin llblgen 3.0 where is what I am tryin to achieve.

I have a table called listings which contains 2 double fields (long and lat). I would like to find all the POI's around a certian POI (I will provide the long/lat) and the radius distance.

Without having to convert my fields from double to spatial, can this be done easily? If so how can the query be written to get this.

I would rather go with the route above as I do not want to convert my fields to spatial.

However, if the above cannot be achieved easily, after I convert my fields to spatials, what do i need to know, i read that I will need the sql server assembly in the gac, is this still true? If after I convert my fields to spatials, what do i need to do to still be able to use llblgen objects, would i need to put the distance calculator in SP or can i juse use the predicate system built in to llblgen?

I guess I am looking for as much information as possible to simply get POI's around a POI within a x radius

Thanks

daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 16-Feb-2012 22:23:27   

I don't know much about the geo-spatial field, but all you have to do is see how would be your ideal way to do it and then see what you can use of LLBLGen.

I don't know how looks your algorithm that receives a lat,lon,radius and return some collections of points. Lets see the options:

A. If you have this in an StoredProcedure, you can just add it to LLBLGen and call it in code. The question here is What is the type that SP returns? It could be a DataTable containing x,y coordinates which you can convert to Point types in memory (at your code's side).

B. If you can do the calculations on T-SQL using math or spatial functions it's likely you can do it using LLBLGen predicates. You just need to use expressions and call database functions. If you are using LINQ2LLBL you would need Function Mappings.

C. If you like to go on spatial data types and use T-SQL spatial functions, you can do it as well. And yes, apparently the assembly that define the UDTs for spatial types must be gac'ed. See this related thread: http://llblgen.com/tinyforum/Messages.aspx?ThreadID=15680

David Elizondo | LLBLGen Support Team