|
View:
New views
3 Messages
—
Rating Filter:
Alert me
|
|
|
GEOMETRIES with different SRIDsHi
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 |
|
|
Re: GEOMETRIES with different SRIDsJust skip the projections altogether.
select st_distance_sphere(st_makepoint(28.060455, -26.056947),st_makepoint(18.3793284, -33.9228922)) This falls apart for queries with large tables, etc, because there's no _sphere equivalent of st_dwithin that can leverage an index well. P. On Sun, Jun 14, 2009 at 9:20 AM, africa4you<a4uofbiz@...> wrote: > > 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 > -- > View this message in context: http://www.nabble.com/GEOMETRIES-with-different-SRIDs-tp24022339p24022339.html > Sent from the PostGIS - User mailing list archive at Nabble.com. > > _______________________________________________ > postgis-users mailing list > postgis-users@... > http://postgis.refractions.net/mailman/listinfo/postgis-users > postgis-users mailing list postgis-users@... http://postgis.refractions.net/mailman/listinfo/postgis-users |
|
|
Re: GEOMETRIES with different SRIDsThank you Paul, this is most useful From: Paul Ramsey <pramsey@...> To: PostGIS Users Discussion <postgis-users@...> Sent: Sunday, June 14, 2009 8:49:36 PM Subject: Re: [postgis-users] GEOMETRIES with different SRIDs Just skip the projections altogether. select st_distance_sphere(st_makepoint(28.060455, -26.056947),st_makepoint(18.3793284, -33.9228922)) This falls apart for queries with large tables, etc, because there's no _sphere equivalent of st_dwithin that can leverage an index well. P. On Sun, Jun 14, 2009 at 9:20 AM, africa4you<a4uofbiz@...> wrote: > > 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 > > 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 > -- > Sent from the PostGIS - User mailing list archive at Nabble.com. > > _______________________________________________ > postgis-users mailing list > postgis-users@... > http://postgis.refractions.net/mailman/listinfo/postgis-users > _______________________________________________ postgis-users mailing list postgis-users@... http://postgis.refractions.net/mailman/listinfo/postgis-users _______________________________________________ postgis-users mailing list postgis-users@... http://postgis.refractions.net/mailman/listinfo/postgis-users |
| Free embeddable forum powered by Nabble | Forum Help |