[OpenLayers-Users] Getting shape-zip outputFormat for a user.

Andreas Hocevar ahocevar at opengeo.org
Thu Jul 14 06:11:59 EDT 2011


Hey Phil,

I'd just request the file with a GET request, e.g.
http://localhost:8080/geoserver/wfs?service=WFS&request=GetFeature&version=1.1.0&typeName=topp:states&outputFormat=shape-zip

If you have to include filters that make the URL too long for a GET
request, you can dynamically create a HTML form and add the parameters
as hidden fields, e.g.

var form = document.createElement("form");
form.method = "POST";
form.action = "http://localhost:8080/geoserver/wfs";
var input = document.createElement("input");
input.type = "hidden";
input.name = "request";
input.value = "GetFeature";
form.appendChild(input);
// repeat the above 5 lines for all parameters
document.body.appendChild(form);
form.submit();

This would result in submitting the following form:

<form method="POST" action="http://localhost:8080/geoserver/wfs">
  <input type="hidden" name="request" value="GetFeature"></input>
</form>

The above is untested, but the same is done in
OpenLayers.Tile.Image.IFrame, and I guess you get the picture.

Regards,
Andreas.

On Thu, Jul 14, 2011 at 7:03 AM, Phil Scadden <p.scadden at gns.cri.nz> wrote:
> I would like to offer users the output of a WFS query in a shapefile and
> since we are using geoserver, I can specify an outputFormat of
> "shape-zip". What is puzzling me though is that WFS is made as POST but
> how do I respond so that user can save the response file?
> --
> Phil Scadden, Senior Scientist GNS Science Ltd 764 Cumberland St,
> Private Bag 1930, Dunedin, New Zealand Ph +64 3 4799663, fax +64 3 477 5232
>
>
> Notice: This email and any attachments are confidential. If received in error please destroy and immediately notify us. Do not copy or disclose the contents.
>
> _______________________________________________
> Users mailing list
> Users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/openlayers-users
>



-- 
Andreas Hocevar
OpenGeo - http://opengeo.org/
Expert service straight from the developers.


More information about the Users mailing list