[OpenLayers-Users] Incomplete GML feature

Bart van den Eijnden (OSGIS) bartvde at osgis.nl
Tue Apr 12 02:47:36 EDT 2011


Hi,

you need to embed your GML geometries in a FeatureCollection for it to work.

Example:

    var shell_start = '<wfs:FeatureCollection
xmlns:wfs="http://www.opengis.net/wfs"><gml:featureMember
xmlns:gml="http://www.opengis.net/gml"><feature:features
xmlns:feature="http://mapserver.gis.umn.edu/mapserver"
fid="221"><feature:geometry>';

    var shell_end =
'</feature:geometry></feature:features></gml:featureMember></wfs:FeatureCollection>';

var gml = shell_start + [your GML] + shell_end;

Best regards,
Bart

> Hi Guys, I really need your help.
>
> I have features kept in my PostGIS database. When I tried to query the
> features from PostGIS using ST_AsGML function, I got following data:
>
> <gml:Polygon><gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>645082.056400000001304,2609956.632699999958277
> 645063.701299999956973,2609918.905300000216812
> 645063.597799999988638,2609918.944600000046194
> 645040.522600000025705,2609925.99709999980405
> 645055.089500000001863,2609963.028799999970943
> 645082.056400000001304,2609956.632699999958277</gml:coordinates>
> </gml:LinearRing></gml:outerBoundaryIs></gml:Polygon>
>
> I think the above data is incomplete GML features. Because when I parsed
> the
> data to obtain OpenLayers.Feature.Vector object using function
> OpenLayers.Format.GML.read(), it returned NULL.
>
> My question: is there any way to create OpenLayers.Feature.Vector from the
> above data in order to show the feature in Vector layer?
>
> Thanks,
> -herry
> _______________________________________________
> Users mailing list
> Users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/openlayers-users
>




More information about the Users mailing list