Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am attempting to insert a geometry into a table using the st_geomfromgml function.

The GML is being sourced from a Geoserver WFS request.

The function call looks like this

st_geomfromgml('<?xml version="1.0" encoding="UTF-8"?><gml:LineString xmlns:gml="" srsName="" srsDimension="2"> <gml:posList>146.48296 -18.6222 146.48296 -18.6222</gml:posList> </gml:LineString>');

This worked on PostGIS version POSTGIS="1.5.3" GEOS="3.3.1-CAPI-1.7.1" PROJ="Rel. 4.7.1, 23 September 2009" LIBXML="2.7.3" USE_STATS

but fails on POSTGIS="2.0.0 r9605" GEOS="3.3.3-CAPI-1.7.4" PROJ="Rel. 4.8.0, 6 March 2012" LIBXML="2.7.8" LIBJSON="UNKNOWN"

However I can make it work if I specify three dimensions like so;

select st_geomfromgml('<?xml version="1.0" encoding="UTF-8"?><gml:LineString xmlns:gml="" srsName="" srsDimension="3"> <gml:posList>146.48296 -18.6222 0 146.48296 -18.6222 0</gml:posList> </gml:LineString>');

Is there a way to keep the geometry in two dimensions and insert it?

share|improve this question
On closer inspection I note that the points in the LineString are the same, this appears to be the cause of my problem. – tojofo Feb 26 '13 at 0:27

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.