[postgis-users] Simple question: How to get projected distance?
Mike Leahy
mgleahy at fes.uwaterloo.ca
Wed Aug 10 09:23:43 PDT 2005
Hey there,
I usually use transform() to convert my data to a UTM projection, so
that I can calculate distances in metres with relative ease - maybe
there's a more accurate way, but this works well enough for me.
As for looking up SRID numbers, someone (either in this list or another)
directed me to http://www.espg.org, where you can download a database of
EPSG projection information, including a version in Microsoft Access
format with forms for browsing. I believe the EPSG identifier is
usually the same as the SRID in the spatial_ref_sys table included with
PostGIS (but you'll want to compare the records for whatever projection
you need to make sure I'm right about that).
Regards,
Mike
Lance Arlaus wrote:
> I know this is a simple question, but I’m just getting started with
> PostGIS and I can’t seem to perform a simple calculation.
>
> I just need to calculate the distance between two points. What am I
> doing wrong?
>
>
>
> Query:
>
> SELECT distance(PointFromText('POINT(40.8117 -74.218)', 32617),
> PointFromText('POINT(40.8272 -74.1242)', 32617))
>
> Returns:
>
> 0.095…
>
> Of course if I do the following, I get a reasonable answer (about
> 10km), but it’s not exactly what I want
>
> SELECT distance_sphere(PointFromText('POINT(40.8117 -74.218)',
> 32617), PointFromText('POINT(40.8272 -74.1242)', 32617))
>
> Even constructing a line and taking the length doesn’t work and I’ve
> tried all SRIDs.
>
>
>
> Sorry to ask such a simple question.
>
> Also, is there a document that describes the well known SRIDs? I’m
> not sure which one to use. For example, the data I’ve got references
> WGS 84, but there’s a ton of SRIDs defined. I’ve found docs
> describing the format of the specification, but how are the SRIDs
> created (who serves as the clearinghouse for this info)?
>
>
>
> Thanks.
>
>------------------------------------------------------------------------
>
>_______________________________________________
>postgis-users mailing list
>postgis-users at postgis.refractions.net
>http://postgis.refractions.net/mailman/listinfo/postgis-users
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20050810/b2e51a54/attachment.html>
More information about the postgis-users
mailing list