I have GML documents which I wish to serve with GeoServer WFS. Essentially, I want to be able to copy the documents to some place e.g. data_dir store and when a GetFeature is done have GeoServer return my GML document as-is but wrap it in wfs:FeatureCollection. I have the schema for the GML as well for the DescribeFeatureType. I'm struggling to figure this out though. Any pointers?


1 Answer 1


You can't do that easily, GML is a great interchange format but a very poor storage format as you have parse all of it to be able to serve parts of it.

Convert your GML into a database table or geopackage and add that to GeoServer.

If you absolutely must store GML, you would need to create a GML datastore extension from the GeoTools GML parser and add that to your GeoServer instance.

  • Would I be able to get back the original GML in this way ? Presumably you mean make postgis table, decode geometry out of my GML and insert into table which has geometry column and the GML as a varchar in another column ? I want to make sure that a WFS GetFeature gets back the original GML wrapped in WFS elements and not something created wholly by GeoServer
    – Waslap
    May 6, 2022 at 9:54
  • No, you'd get back valid GML but not necessaraly the original. If you just want to serve your GML use a web server
    – Ian Turton
    May 6, 2022 at 10:28
  • Problem with a web server is i'd have to implement the WFS protocol myself else no/few GIS clients will work with it plus there'd be no filter capability on the geometry
    – Waslap
    May 6, 2022 at 10:37
  • 1
    Even using the GML datastore, GeoServer would read the GML (if it's made of simple features, mind) and then build it from scratch in output. There is no direct "GML to GML" code path. May 6, 2022 at 12:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.