[postgis-users] select from layer where spatial-relationship geom-from-KML

Martin Feuchtwanger feumar at shaw.ca
Tue Jan 15 16:19:53 PST 2013


Following my question (from month ago), i first thought Simon's answer 
was correct as i didn't get an error message.
However, i wasn't getting any /results /either. Returning to the issue 
(after a long break) i now realize the answer is something like this:

SELECT * FROM layer
WHERE  ST_spatial-relate-function( geom, *ST_Transform*( ST_GeomFromKML( 
'kml-point' ), 3005 ) )

Martin Feuchtwanger  feumar at shaw.ca
http://members.shaw.ca/geomatics.developer

/On Thu Dec 13 15:26:57 PST 2012,//Simon Greener wrote:
/
Martin,

Why not enforce the SRID as follows:

SELECT * FROM layer
WHERE ST_Relate( geom, ST_SetSRID(ST_GeomFromKML('<Point><coordinates>-125.6077,49.8986</coordinates></Point>'),3005) );

regards
Simon

On 13/12/2012 2:49 PM, Martin Feuchtwanger wrote:
> I have a layer table in postgis and an external point.
> The layer SRID is 3005 and the external point is in KML.
> I need help with this form of selection:
>
> SELECT * FROM layer WHERE ST_spatial-relate( geom, ST_GeomFromKML( 
> 'kml-point' ) )
>
> The 'kml-point' is like this 
> '<Point><coordinates>-125.6077,49.8986</coordinates></Point>'
> and the ST_spatial-relate() is one of the many spatial-relationship 
> functions that take 2 geometries and return a boolean.
>
> When i use ST_Disjoint(), i get "ERROR:  Operation on mixed SRID 
> geometries"
> When i use ST_Contains(), i get no error message but no rows either 
> (there should be some).
>
> I understand that other conversion functions, such as 
> ST_GeomFromText(), would need an SRID qualifier, but i didn't think 
> that ST_GeomFromKML() should.
>
> I've tried a few variations of prefixing the 'kml-point' with 
> srid=3005; and postfixing it with ::geometry and get a variety of 
> error messages.
>
> What am i doing wrong?
>
> PostGIS_Full_Version()
> "POSTGIS="2.0.1 r9979" GEOS="3.3.5-CAPI-1.7.5" PROJ="Rel. 4.8.0, 6 
> March 2012" GDAL="GDAL 1.9.1, released 2012/05/15" LIBXML="2.7.8" 
> LIBJSON="UNKNOWN" RASTER"
>
> Thanks,
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20130115/07d4aabd/attachment.html>


More information about the postgis-users mailing list