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?
1 Answer 1
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 & YIan Turton– Ian Turton2015年11月30日 09:08:48 +00:00Commented Nov 30, 2015 at 9:08
-
Hi iant, you're right, I'm going to fix my answerAndrea Aime– Andrea Aime2015年11月30日 10:28:58 +00:00Commented Nov 30, 2015 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– Caio Belfort2015年12月01日 02:45:29 +00:00Commented Dec 1, 2015 at 2:45