1

I'm using geoserver (2.4.4) to provide users with shapefile downloads. Some of the software the shapefiles are going to be used in requires .prj-files that follows the "ESRI-standard". A bit of searching lead me to a Geoserver ticket (GEOS-4503), and by downloading esri.properties from there and placing it in my %GEOSERVER_DATA_DIR%/user_projections folder I can issue a GET request to:

http://localhost:8080/geoserver/bw/ows?service=WFS&version=1.1.0&request=GetFeature&typeName=ns:layername&outputFormat=SHAPE-ZIP&format_options=PRJFILEFORMAT:ESRI

and i get back a zipfile with (amongst the other files) a .prj-file with the following:

GEOGCS["GCS_WGS_1984",DATUM["D_WGS_1984",SPHEROID["WGS_1984",6378137.0,298.257223563]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433]]

This is fine, as my data is in EPSG:4326 and the string above is indeed the "ESRI-type" I want.

However, i also need the user to filter their data, so I've figured that I need to use a filter, and thus POST an XML-file like this:

<wfs:GetFeature service="WFS" version="1.0.0"  
                xmlns:wfs="http://www.opengis.net/wfs"
                xmlns:ogc="http://www.opengis.net/ogc"
                xmlns:gml="http://www.opengis.net/gml"
                xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                xsi:schemaLocation="http://www.opengis.net/wfs
                http://schemas.opengis.net/wfs/1.1.0/wfs.xsd">
                <wfs:Query typeName="ns:layername" srsName="EPSG:4326">            

            <ogc:Filter> 
                <PropertyIsEqualTo>
                    <PropertyName>version</PropertyName>
                    <Literal>56</Literal>
                </PropertyIsEqualTo>
            </ogc:Filter>

                </wfs:Query>
            </wfs:GetFeature>

to an url like:

http://localhost:8080/geoserver/bw/ows?outputFormat=SHAPE-ZIP&format_options=PRJFILEFORMAT:ESRI

I also get a zip-file with the data back, but this time the .prj file has this content:

GEOGCS["WGS 84", DATUM["World Geodetic System 1984", SPHEROID["WGS 84", 6378137.0, 298.257223563, AUTHORITY["EPSG","7030"]], AUTHORITY["E
PSG","6326"]], PRIMEM["Greenwich", 0.0, AUTHORITY["EPSG","8901"]], UNIT["degree", 0.017453292519943295], AXIS["Geodetic longitude", EAST]
, AXIS["Geodetic latitude", NORTH], AUTHORITY["EPSG","4326"]]

And this is indeed the OGC-prj-format.

(In addition to setting format_options=PRJFILEFORMAT:ESRI I've also tried to check the "Use ESRI WKT format for SHAPE-ZIP generated .prj files" box in the WFS-page in the geoserver GUI).

Why does the override of prj-file-format work on a GET but not on a POST?

2

It may be related to the different version of the WFS protocol you used in the two requests. Not sure, I was not the one to implement GEOS-4503

  • Nice catch. I'm rather certain that I've tried version=1.1.0 in the non-working case as well, but i'll re-test – atlefren May 12 '14 at 6:24
  • The WFS-POST returns the same result when specifying version=1.1.0. – atlefren May 12 '14 at 7:13
0

After some more digging (thanks to Andrea for clarifiction) I ended up trying a couple of things more or less on random.

I've found that in order to get ESRI-style-prj-files from a WFS POST request you have to be sure of two things:

  1. Check the box "Use ESRI WKT format for SHAPE-ZIP generated .prj files" box in the WFS-page in the geoserver GUI"
  2. Send your POST-request to the /geoserver/ows or /geoserver/wfs endpoint (and NOT to the /geoserver/NS/wfs endpoint.

So, you have to set the GUI option to use ESRI format and you cannot use an URL that includes the namespace. In addition, the format_options=PRJFILEFORMAT:ESRI query-param does not have any effect.

  • Regarding the namespace issue: as long as you go to the WFS-settings page for your namespace and check "Use ESRI WKT format for SHAPE-ZIP generated .prj files" box in the WFS-page in the geoserver GUI" there it's fine to use the namespace in the url – atlefren May 12 '14 at 9:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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