The size of an URL is limited. Therefore I'm not able to request a WFS with a complex geometry. I read (Geoserver POST filter to WMS layer) that is possible to do in a WMS, but I didn't get it to work.

I'm using Postman to POST to my geoserver and add raw body data like this:

CQL_FILTER=INTERSECTS(geometry, POLYGON ((0 0, 1 1....))

I also tried it in key-value form type. I also tried url-encoding it first.

Does anyone know how to query with large geometries? (WKT in my case).


Complete post request would be

var url = 'http://localhost/geoserver/ows?service=WFS&version=1.0.0&outputFormat=application%2Fjson&request=GetFeature&typeName=topp:states',
    wktRepresentation = 'POLYGON((579832.0820867891 165971.37415659515,579946.6092781681 165790.03943691167,580180.4356272336 165914.11056090562,580149.4178462351 166047.7256175145,579832.0820867891 165971.37415659515))';

$.post(url, { cql_filter: 'INTERSECTS(geom, ' + wktRepresenation + ')' }, function(data, textStatus, xhr) {

Coordinates are in different projection for my example but just change them with coordinate system which you are using.

  • 1
    Thank you for taking the time to post this back for others to use. It saved me. – andyteucher Jun 10 '19 at 21:06

I already found an answer myself: I had to use x-www-form-urlencoded key-value data.

  • 4
    Could you add one complete request as an example? That could help other users in the future. – user30184 May 25 '16 at 15:37

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.