1

I want to find the nearest point having latitude and longitude stored as Point in SpatiaLite. I read this and it has this example:

SELECT feature_name, feature_class, 
     ST_Distance(Geometry, MakePoint(-70.250, 43.802)) AS Distance FROM XYGNIS 
WHERE distance < 0.1 AND ROWID IN 
( SELECT ROWID FROM SpatialIndex 
  WHERE f_table_name = 'XYGNIS' AND search_frame = 
  BuildCircleMbr(-70.250,    43.802, 0.1)) 
ORDER BY distance LIMIT 10

I cannot use it, however, since ST_Distance requiring compiling SpatiaLite with GEOS, which is in LGPL, which I cannot use. Is there a way I can do arithmetics to calculate distance and set that to a "variable" and then find the one with the minimal distance?

huggie
  • 17,587
  • 27
  • 82
  • 139
  • Maybe you want to move your question to http://gis.stackexchange.com – DarK Sep 16 '12 at 00:50
  • 1
    Good idea I will post it there, too. But isn't Stackoverflow for everything? – huggie Sep 16 '12 at 04:03
  • It is, but GIS is specific to that and you'll probably get more attention and better answers there. – DarK Sep 16 '12 at 12:39
  • If you want a distance, you'll have to calculate it. If you can't use GEOS, you can create your own extension or otherwise implement it (its basic cartesian math). However you should just use GEOS - no reason to not use LGPL code (I could understand GPL, but not LGPL). – BradHards Jan 07 '14 at 22:43
  • Answer is on [GIS.Stackexchange][1] [1]: http://gis.stackexchange.com/a/33617/1825 – DefenestrationDay Apr 08 '14 at 22:07

0 Answers0