Home > geoserver > Geoserver WFS POST and format_options=PRJFILEFORMAT

Geoserver WFS POST and format_options=PRJFILEFORMAT

May 9Hits:3
Advertisement

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. Why?

(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).

So, the question is thus: Why does the override of prj-file-format work on a GET but not on a POST? Is this a known bug, have I discovered a bug or am I doing something wrong? Any pointers, ideas or tricks for debugging this is appreciated!

Answers

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

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.

Related Articles

  • Geoserver WFS POST and format_options=PRJFILEFORMATMay 9

    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)

  • Geoserver WFS get feature doesn't work - "SyntaxError: missing ; before statement"

    Geoserver WFS get feature doesn't work - "SyntaxError: missing ; before statement"December 3

    I'm trying to use geoserver WFS json for creating vector layer (instead of using WMS) because this is a layer I redraw every 20 seconds. This is the code I use : function getJSON() { var geoJsonUrl = "http://localhost:8080/geoserver/test/ows?service=

  • Drupal-Geoserver WFS error September 24

    I am having trouble getting a WFS layer working using Geoserver, OpenLayers and GeoExt. I get the following error: XMLHttpRequest cannot load http://10.0.0.155/geoserver/wfs. Origin http://10.0.0.155:8080 is not allowed by Access-Control-Allow-Origin

  • How to add GeoServer wfs layer on OpenLayers?

    How to add GeoServer wfs layer on OpenLayers?March 4

    I can't seem to add a WFS layer like this. It works when i copy all this code locally but as soon as i change the values to point to my own layer within my own GeoServer this is the response viewed in firebug: Could not locate {http://www.mydomain.co

  • geoserver wfs insert errorApril 27

    I keep getting an insert error from geoserver when trying to save a point, poly etc etc to my postgis table. any ideas, my code is below var Projection = new OpenLayers.Projection("EPSG:4326"); var map = new OpenLayers.Map("Map", { //p

  • Allow GeoServer WFS request by featureIDApril 6

    I'm not able to use the featureID parameter in a WFS URL request for my dataset on GeoServer. Example: http://demo.opengeo.org/geoserver/wfs?version=1.1.0&service=wfs&request=GetFeature&typeName=topp:tasmania_roads&maxFeatures=10&featu

  • Releasing GeoServer WFS-T Feature LockMay 24

    For some reason I'm having trouble finding any documentation about releasing feature locks in a GeoServer WFS (or any WFS for that matter). I can easily request a FeatureLock with a request like this http://localhost:8080/geoserver/wfs?service=WFS&ve

  • GeoServer WFS OpenLayers EditingPanel ProblemJune 13

    I'm trying to use OpenLayers to edit features of vector data served from a local geoserver. So far, I'm able to pull WMS and WFS layers using OpenLayers from the same geoserver. But now, I'd like enable editing of features of the vector layers. The r

  • What's the correct link for adding GeoServer WFS to ArcMap?

    What's the correct link for adding GeoServer WFS to ArcMap?January 27

    What is the correct URL to enter in ArcCatalog WFS Parameters when adding a WFS layer from GeoServer into ArcMap? Here's a link to our Get Capabilities document: https://weaveprod.ucdp.utah.edu/geoserver/ows?service=wfs&version=1.0.0&request=GetCa

  • Geoserver WFS Fails to Load in OpenLayers

    Geoserver WFS Fails to Load in OpenLayersMarch 31

    I'm working with Postgis->Geoserver->openlayers on localhost. I followed a Geoserver tutorial to import some nyc sample data into my postgres/postgis database and link it to Geoserver. The layer seems to display correctly in Geoserver using the open

  • Geoserver WFS - Can I Pass in Filter Parameters via the URL?August 13

    I'm trying to use PHP's CURL function to fetch geoJSON information from a GeoServer instance. I'm doing this using url variables rather than trying to construct a full xml GetFeature request. However, I would like to be able to get a subset of the re

  • QGIS does not update data in Geoserver WFS-TNovember 14

    I am trying to edit a WFS from geoserver (using PostGIS data) within QGIS. This is the request as recorded by Fiddler <Transaction xmlns="http://www.opengis.net/wfs" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version=&quo

  • Geoserver WFS-T insert no response. bug?December 1

    I use Geoserver + Openlayers and want to add and save some new Points via WFS-T. I created insert transaction (correct) and sent it, but no response (include errors) was returned. In console was only: 01 dec 17:34:16 INFO [geoserver.wfs] - Request: g

  • Geoserver WFS 2.0 CSV Output Multiple Features/typeNamesJanuary 27

    I'm setting up an export function so that users may download data from a Geoserver WFS 2.0 service in a variety of the supported formats. The service has multiple FeatureTypes which should be available for export in a single query (along with BBOX an

  • GeoTools WFS Query sortBy not working for GeoServer WFSFebruary 17

    I am using GeoTools to query a GeoServer WFS using the following code: Map connectionParameters = new HashMap(); connectionParameters.put("WFSDataStoreFactory:GET_CAPABILITIES_URL", String.format("%s&request=GetCapabilities", wfsUr

  • Oracle / GeoServer / WFS-T / Openlayers many polygons as one featureFebruary 26

    Newbie question regarding Oracle / GeoServer / WFS-T / Openlayers. I am creating a table that will hold geometry features a user creates/updates. My question is, I would like to have just one record in the table per customer (customerId). Can I creat

  • Using GeoServer WFS to GetFeature by Clicking on it on the mapSeptember 4

    Can someone point me to document of crafting a Geoserver WFS GetFeature request with CQL_Filters? I've already read the GeoServer CQL_Filter Geometric filter section I have a Geoserver WMS set up to return multiple polygon geometries (from a postgres

  • Accessing GeoServer WFS services in ArcGIS Online map viewer?September 9

    Has anyone was able to add GeoServer WFS service into ArcGIS Online map viewer? By this I mean having an ArcGIS Online account (either free or for Organizations), logging in and adding layers from the web. I have no problems adding a WMS service such

  • Receiving -infinity in geoserver wfs GetFeature resultOctober 16

    I'm currently using: - Geoserver 2.7.2 - PostgreSQL 9.4.4 - PostGIS 2.1.9 When I submit the following wfs GetFeature request: http://localhost:8080/geoserver/wfs?service=wfs&version=2.0.0&request=GetFeature&typeNames=gis:roads&propertyName

  • Geoserver WFS-T "Feature type 'Workspace:Layer' is not available" Error on update / deleteDecember 1

    I am using the following code for insert / update (changed from this source: http://wordpress-dbauszus.rhcloud.com/?p=71): var formatWFS = new ol.format.WFS(); // GML Format zur Interaktion mit WFS var formatGML = new ol.format.GML({ featureNS: 'http

Copyright (C) 2017 ceus-now.com, All Rights Reserved. webmaster#ceus-now.com 14 q. 1.120 s.