<html><head><style type="text/css"><!-- DIV {margin:0px;} --></style></head><body><div style="font-family:times new roman,new york,times,serif;font-size:12pt"><div>Thank you Paul, this is most useful<br></div><div style="font-family: times new roman,new york,times,serif; font-size: 12pt;"><br><div style="font-family: arial,helvetica,sans-serif; font-size: 13px;"><font size="2" face="Tahoma"><hr size="1"><b><span style="font-weight: bold;">From:</span></b> Paul Ramsey <pramsey@cleverelephant.ca><br><b><span style="font-weight: bold;">To:</span></b> PostGIS Users Discussion <postgis-users@postgis.refractions.net><br><b><span style="font-weight: bold;">Sent:</span></b> Sunday, June 14, 2009 8:49:36 PM<br><b><span style="font-weight: bold;">Subject:</span></b> Re: [postgis-users] GEOMETRIES with different SRIDs<br></font><br>
Just skip the projections altogether.<br><br>select st_distance_sphere(st_makepoint(28.060455,<br>-26.056947),st_makepoint(18.3793284, -33.9228922))<br><br>This falls apart for queries with large tables, etc, because there's<br>no _sphere equivalent of st_dwithin that can leverage an index well.<br><br>P.<br><br>On Sun, Jun 14, 2009 at 9:20 AM, africa4you<<a ymailto="mailto:a4uofbiz@yahoo.com" href="mailto:a4uofbiz@yahoo.com">a4uofbiz@yahoo.com</a>> wrote:<br>><br>> Hi<br>><br>> I have two points in different SRID's and would like to calculate the<br>> distance between them, unfortunately this type of operation doesnt seem to<br>> be valid (Operation on two GEOMETRIES with different SRIDs ). Any help in<br>> solving this issue would be appreciated. Please see the sql below:<br>><br>> Kind regards<br>><br>> Grant Edwards<br>><br>> SELECT postgis_full_version()<br>> "POSTGIS="1.3.3" GEOS="3.0.0-CAPI-1.4.1"
 PROJ="Rel. 4.6.0, 21 Dec 2007"<br>> USE_STATS"<br>><br>><br>><br>> SELECT utmzone(ST_Centroid(setsrid((makepoint(28.060455,<br>> -26.056947)),4326))); //Johannesburg (utmzone = 32735)<br>> EPSG Projection 32735 - WGS 84 / UTM zone 35S<br><span>> <a target="_blank" href="http://spatialreference.org/ref/epsg/32735/">http://spatialreference.org/ref/epsg/32735/</a></span><br>><br>> SELECT utmzone(ST_Centroid(setsrid((makepoint(18.3793284,<br>> -33.9228922)),4326))); //Cape Town (utmzone = 32734)<br>> EPSG Projection 32734 - WGS 84 / UTM zone 34S<br><span>> <a target="_blank" href="http://spatialreference.org/ref/epsg/32734/">http://spatialreference.org/ref/epsg/32734/</a></span><br>><br>> SELECT  ST_Distance(ST_Transform(setsrid((makepoint(28.060455,<br>> -26.056947)),4326),utmzone(ST_Centroid(setsrid((makepoint(28.060455,<br>> -26.056947)),4326)))) ,<br>>            
        ST_Transform(setsrid((makepoint(18.3793284,<br>> -33.9228922)),4326),utmzone(ST_Centroid(setsrid((makepoint(18.3793284,<br>> -33.9228922)),4326)))))  as dist_meters<br>><br>><br>> ERROR:  Operation on two GEOMETRIES with different SRIDs<br>> --<br><span>> View this message in context: <a target="_blank" href="http://www.nabble.com/GEOMETRIES-with-different-SRIDs-tp24022339p24022339.html">http://www.nabble.com/GEOMETRIES-with-different-SRIDs-tp24022339p24022339.html</a></span><br>> Sent from the PostGIS - User mailing list archive at <a target="_blank" href="http://Nabble.com">Nabble.com</a>.<br>><br>> _______________________________________________<br>> postgis-users mailing list<br>> <a ymailto="mailto:postgis-users@postgis.refractions.net" href="mailto:postgis-users@postgis.refractions.net">postgis-users@postgis.refractions.net</a><br><span>> <a target="_blank"
 href="http://postgis.refractions.net/mailman/listinfo/postgis-users">http://postgis.refractions.net/mailman/listinfo/postgis-users</a></span><br>><br>_______________________________________________<br>postgis-users mailing list<br><a ymailto="mailto:postgis-users@postgis.refractions.net" href="mailto:postgis-users@postgis.refractions.net">postgis-users@postgis.refractions.net</a><br><a href="http://postgis.refractions.net/mailman/listinfo/postgis-users" target="_blank">http://postgis.refractions.net/mailman/listinfo/postgis-users</a><br></div></div></div><br>

      </body></html>