I want make some query based in lon/lat values of a specific place. A simple example is this:

SELECT C.tipo, C.geom
FROM climas AS C
WHERE ST_Contains(ST_SetSRID(C.geom, 4326), ST_SetSRID(ST_Point(%x%, %y%),    4326))

As default values for x and y, I put the lon/lat coordinates of my city (-44, -3)

The problem is, when I visualize the layer without params, this works. When I put the params, if they are negative, I receive a message saying:

error:java.lang.RuntimeException: java.io.IOException java.lang.RuntimeException: java.io.IOException java.io.IOExceptionInvalid value for parameter x

I'm using the default regular expression hinted by geoserver. Need something for negative values in the URL? Or maybe the regular expression isn't correct?


x and y are well know WMS 1.1 request parameters, the parser for those is probably kicking in and rejecting their values. Try to use parameter names that are not well known protocol keys

  • actually I think in WMS 1.3 they are I & J but WNS 1.0 and 1.1 are X & Y – Ian Turton Nov 30 '15 at 9:08
  • Hi iant, you're right, I'm going to fix my answer – Andrea Aime Nov 30 '15 at 10:28
  • Thank you guys! Change the x and y for lon lat, but doesn't work. Finally I search in the web for some regex with negative values, and now I'm able to do the query. Using this: ^[+-]?[0-9]{1,9}(?:\.[0-9]{1,2})?$ Anyway, I'm using WFS. – Caio Belfort Dec 1 '15 at 2:45

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.