« Return to Thread: GEOMETRIES with different SRIDs

GEOMETRIES with different SRIDs

by africa4you :: Rate this Message:

Reply to Author | View in Thread

Hi

I have two points in different SRID's and would like to calculate the distance between them, unfortunately this type of operation doesnt seem to be valid (Operation on two GEOMETRIES with different SRIDs ). Any help in solving this issue would be appreciated. Please see the sql below:

Kind regards

Grant Edwards

SELECT postgis_full_version()
"POSTGIS="1.3.3" GEOS="3.0.0-CAPI-1.4.1" PROJ="Rel. 4.6.0, 21 Dec 2007" USE_STATS"



SELECT utmzone(ST_Centroid(setsrid((makepoint(28.060455, -26.056947)),4326))); //Johannesburg (utmzone = 32735)
EPSG Projection 32735 - WGS 84 / UTM zone 35S
http://spatialreference.org/ref/epsg/32735/

SELECT utmzone(ST_Centroid(setsrid((makepoint(18.3793284, -33.9228922)),4326))); //Cape Town (utmzone = 32734)
EPSG Projection 32734 - WGS 84 / UTM zone 34S
http://spatialreference.org/ref/epsg/32734/

SELECT  ST_Distance(ST_Transform(setsrid((makepoint(28.060455, -26.056947)),4326),utmzone(ST_Centroid(setsrid((makepoint(28.060455, -26.056947)),4326)))) ,
                    ST_Transform(setsrid((makepoint(18.3793284, -33.9228922)),4326),utmzone(ST_Centroid(setsrid((makepoint(18.3793284, -33.9228922)),4326)))))  as dist_meters


ERROR:  Operation on two GEOMETRIES with different SRIDs

 « Return to Thread: GEOMETRIES with different SRIDs