0

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?

PolyGeo
65.5k29 gold badges115 silver badges350 bronze badges
asked Nov 30, 2015 at 0:44

1 Answer 1

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

answered Nov 30, 2015 at 7:19
3
  • actually I think in WMS 1.3 they are I & J but WNS 1.0 and 1.1 are X & Y Commented Nov 30, 2015 at 9:08
  • Hi iant, you're right, I'm going to fix my answer Commented 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. Commented Dec 1, 2015 at 2:45

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.