<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta content="text/html;charset=windows-1252"
 http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Hey there,<br>
<br>
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.<br>
<br>
As for looking up SRID numbers, someone (either in this list or
another) directed me to <a class="moz-txt-link-freetext" href="http://www.espg.org">http://www.espg.org</a>, 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).<br>
<br>
Regards,<br>
Mike<br>
<br>
Lance Arlaus wrote:
<blockquote cite="mid001501c59dbc$bdb4ea90$6401a8c0@LanceLaptop"
 type="cite">
  <meta http-equiv="Content-Type" content="text/html; ">
  <meta name="Generator" content="Microsoft Word 10 (filtered)">
  <style>
<!--
 /* Style Definitions */
 p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman";}
a:link, span.MsoHyperlink
        {color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {color:purple;
        text-decoration:underline;}
span.emailstyle17
        {font-family:Arial;
        color:windowtext;}
span.emailstyle18
        {font-family:Arial;
        color:navy;}
span.EmailStyle19
        {font-family:Arial;}
@page Section1
        {size:8.5in 11.0in;
        margin:1.0in 1.25in 1.0in 1.25in;}
div.Section1
        {page:Section1;}
-->
  </style>
  <div class="Section1">
  <p class="MsoNormal"><font face="Arial" size="2"><span
 style="font-size: 10pt; font-family: Arial;">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.</span></font></p>
  <p class="MsoNormal"><font face="Arial" size="2"><span
 style="font-size: 10pt; font-family: Arial;">I just need to calculate
the distance between two
points.  What am I doing wrong?</span></font></p>
  <p class="MsoNormal"><font face="Arial" size="2"><span
 style="font-size: 10pt; font-family: Arial;"> </span></font></p>
  <p class="MsoNormal"><font face="Arial" size="2"><span
 style="font-size: 10pt; font-family: Arial;">Query:</span></font></p>
  <p class="MsoNormal"><font face="Arial" size="2"><span
 style="font-size: 10pt; font-family: Arial;">    SELECT
distance(PointFromText('POINT(40.8117 -74.218)', 32617),
PointFromText('POINT(40.8272 -74.1242)', 32617))</span></font></p>
  <p class="MsoNormal"><font face="Arial" size="2"><span
 style="font-size: 10pt; font-family: Arial;">Returns:</span></font></p>
  <p class="MsoNormal"><font face="Arial" size="2"><span
 style="font-size: 10pt; font-family: Arial;">    0.095…</span></font></p>
  <p class="MsoNormal"><font face="Arial" size="2"><span
 style="font-size: 10pt; font-family: Arial;">Of course if I do the
following, I get a reasonable answer
(about 10km), but it’s not exactly what I want</span></font></p>
  <p class="MsoNormal"><font face="Arial" size="2"><span
 style="font-size: 10pt; font-family: Arial;">    SELECT
distance_sphere(PointFromText('POINT(40.8117 -74.218)', 32617),
PointFromText('POINT(40.8272 -74.1242)', 32617))</span></font></p>
  <p class="MsoNormal"><font color="navy" face="Arial" size="2"><span
 style="font-size: 10pt; font-family: Arial; color: navy;">Even
constructing a line and taking the
length doesn’t work and I’ve tried all SRIDs.</span></font></p>
  <p class="MsoNormal"><font color="navy" face="Arial" size="2"><span
 style="font-size: 10pt; font-family: Arial; color: navy;"> </span></font></p>
  <p class="MsoNormal"><font face="Arial" size="2"><span
 style="font-size: 10pt; font-family: Arial;">Sorry to ask such a
simple question.</span></font></p>
  <p class="MsoNormal"><font face="Arial" size="2"><span
 style="font-size: 10pt; font-family: Arial;">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)?</span></font></p>
  <p class="MsoNormal"><font face="Arial" size="2"><span
 style="font-size: 10pt; font-family: Arial;"> </span></font></p>
  <p class="MsoNormal"><font face="Arial" size="2"><span
 style="font-size: 10pt; font-family: Arial;">Thanks.</span></font></p>
  </div>
  <pre wrap="">
<hr size="4" width="90%">
_______________________________________________
postgis-users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:postgis-users@postgis.refractions.net">postgis-users@postgis.refractions.net</a>
<a class="moz-txt-link-freetext" href="http://postgis.refractions.net/mailman/listinfo/postgis-users">http://postgis.refractions.net/mailman/listinfo/postgis-users</a>
  </pre>
</blockquote>
</body>
</html>