[postgis-users] accuracy of coverage

Gold, Jack L (US SSA) jack.gold at baesystems.com
Wed May 1 14:41:27 PDT 2013


Thanks for the explanation Andy.  This should explain what I'm seeing.  I'll make sure to test this out.  

--Jack

-----Original Message-----
From: postgis-users-bounces at lists.osgeo.org [mailto:postgis-users-bounces at lists.osgeo.org] On Behalf Of Andy Anderson
Sent: Wednesday, May 01, 2013 3:35 PM
To: PostGIS Users Discussion
Subject: Re: [postgis-users] accuracy of coverage

>From http://postgis.refractions.net/documentation/manual-svn/ST_DWithin.html :

	boolean ST_DWithin(geography gg1, geography gg2, double precision distance_meters);
	boolean ST_DWithin(geography gg1, geography gg2, double precision distance_meters, boolean use_spheroid);

	For geography units are in meters and measurement is defaulted to use_spheroid=true (measure around WGS 84 spheroid), 
	for faster check, use_spheroid=false to measure along sphere.

Jack mentions that "location" is a geography, so this statement should be fine:

	ST_DWithin(location, ST_geographyFromText("SRID=4326;POINT(-85.0000035762821 32.49999701976208)"), 4000.0)

But note that Google Maps uses a sphere, so try adding the fourth parameter as FALSE and then hopefully they'll give the same result.

The effect of the spheroid squashing at the poles puts the latitude measurement vertex off center, which pushes the earth surface location for the same angle closer to the equator and reduces its effective northerly distance (and may thereby pull it within the ring):

	http://upload.wikimedia.org/wikipedia/commons/thumb/e/e9/Ellipsoid_reduced_angle_definition.svg/200px-Ellipsoid_reduced_angle_definition.svg.png 

-- Andy

On May 1, 2013, at 3:04 PM, Hugues François wrote:

> Hello,
> 
> I am not sure, but if i remember well, i think i read somewhere st_dwithin didn't work with geographies. Did you try the same st_dwithin in combination with st_transform to test the same spatial relation with the local srid or with google srid ?
> 
> Hugues.
> 
> -----Message d'origine-----
> De : postgis-users-bounces at lists.osgeo.org 
> [mailto:postgis-users-bounces at lists.osgeo.org] De la part de Gold, 
> Jack L (US SSA) Envoyé : mercredi 1 mai 2013 20:34 À : PostGIS Users 
> Discussion Objet : Re: [postgis-users] accuracy of coverage
> 
> This 4000.0 is a double precision distance as defined by ST_DWithin ("The distance is specified in units defined by the spatial reference system of the rasters"), so it better not be degrees.
> 
> --Jack
> 
> -----Original Message-----
> From: postgis-users-bounces at lists.osgeo.org 
> [mailto:postgis-users-bounces at lists.osgeo.org] On Behalf Of 
> b.j.kobben at utwente.nl
> Sent: Wednesday, May 01, 2013 1:25 PM
> To: postgis-users at lists.osgeo.org
> Subject: Re: [postgis-users] accuracy of coverage
> 
> Since Gmaps uses not the geographic positions (lat-lon), but the feared "google maps projection" which has many geodetic problems, I would trust the PG calculation. However, are you sure the 4000 in your SQL will be interpreted as meters, not as 4000 decimal degrees (in that case the point will certainly always be inside, of course)?
> 
> Barend
> 
> --
> Barend Köbben
> Senior Lecturer, ITC - University of Twente, Faculty of 
> Geo-Information Science and Earth Observation PO Box 217, 7500AE 
> Enschede (The Netherlands)
> +31-(0)53 4874 253
> +++++++++++++++++++++++
> FOSS4G 2013: Geo for All
> Nottingham (UK), 17-21 Sep 2013
> http://2013.foss4g.org
> +++++++++++++++++++++++
> 
> 
> 
> 
> On 01-05-13 17:15, "Gold, Jack L  (US SSA)" <jack.gold at baesystems.com>
> wrote:
> 
>> I am trying to determine the accuracy of the ST_DWithin function.  I 
>> have a position at 32.52550166, -84.96989441 and I want to know if it 
>> is within a projected circle of 4km radius centered on 32.5, -85.
>> 
>> I am running the following query:
>> 
>> SELECT "id","location", ST_AsText(location) as "text_position" FROM 
>> "positions" WHERE (ST_DWithin(location,
>> ST_geographyFromText("SRID=4326;POINT(-85.0000035762821
>> 32.49999701976208)"), 4000.0))
>> 
>> ³location² is defined as a geography
>> 
>> 
>> When I map this out, Google Maps shows the position report outside of 
>> the 4km ring as does my application, but the database is reporting 
>> that the position is within the 4km range of the ring.  I suspect the 
>> error is small, but I¹m wondering  where it lies.
>> 
>> Any ideas?
>> 
>> 
>> 
>> 
> 
> _______________________________________________
> postgis-users mailing list
> postgis-users at lists.osgeo.org
> http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users
> _______________________________________________
> postgis-users mailing list
> postgis-users at lists.osgeo.org
> http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users
> _______________________________________________
> postgis-users mailing list
> postgis-users at lists.osgeo.org
> http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users

_______________________________________________
postgis-users mailing list
postgis-users at lists.osgeo.org
http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users


More information about the postgis-users mailing list