[postgis-users] Distance function Trouble

I B Adams aca04iba at sheffield.ac.uk
Tue Apr 24 09:24:14 PDT 2007


I appear to be having some trouble with the distance function. I can get all
the distances of pois from my junction point using the SQL:
 
select poi.the_geom, distance(poi.the_geom, (SELECT the_geom FROM junctions
WHERE old_id = 228260200050018 )) from poi order by distance

this gives me the closest junction with distance 0.00718278491319708.

The junctions.the_geom for old_id returns
01010000206A690000E0724A404C42F6BF64E597C118B14A40

and the the_geom for the nearest poi is
01010000206A690000A0EA573A1F5EF6BFC70F9546CCB04A40


My SRID for these tables is 26986
When I query my spatial_ref table with SQL

select * from spatial_ref_sys where srid=(select srid(the_geom) from poi limit
1

which then says

"+proj=lcc +lat_1=42.68333333333333 +lat_2=41.71666666666667 +lat_0=41
+lon_0=-71.5 +x_0=200000 +y_0=750000 +ellps=GRS80 +datum=NAD83 +units=m
+no_defs "

I get the same for my junctions table.

units=m I think I read somewhere means meters. Thus if I understand correctly
the poi is supposed to be 0.007 meters away. However when I add both points to
a map and view them they are quite a long way apart. Have i read the units
wrong or is the distance function not working correctly with my data



More information about the postgis-users mailing list