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

Martin Feuchtwanger feumar at shaw.ca
Thu Dec 13 14:49:44 PST 2012


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,

-- 
Martin Feuchtwanger  feumar at shaw.ca  604-254-0361



More information about the postgis-users mailing list