I am working on a web map project with GeoServer 2.4.1, OpenLayers 2.12 and GeoExt.
I’m having some trouble with the OpenLayers.Control.WMSGetFeatureInfo. On certain layers, GeoServer returns “ERROR: Operation on mixed SRID geometries”.
The request from OpenLayers for one of the layers looks like this: http://myserver:8080/geoserver/ows?LAYERS=heartland%3Atraffic_scenario_a&QUERY_LAYERS=heartland%3Atraffic_scenario_a&STYLES=&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetFeatureInfo&BBOX=-10721313.983985%2C5029177.270038%2C-10642507.407823%2C5080619.390073&FEATURE_COUNT=3&HEIGHT=673&WIDTH=1031&FORMAT=image%2Fpng&INFO_FORMAT=application%2Fvnd.ogc.gml&X=265&Y=258
The query looks like this:
SELECT count(*) AS gt_result_ FROM (SELECT * FROM “heartland”.“traffic_scenario_a” WHERE (“geom” && ST_GeomFromText(‘POLYGON ((-10701440.356630858 5061280.821917198, -10700675.986348007 5061280.821917198, -10700675.986348007 5060516.45163436, -10701440.356630858 5060516.45163436, -10701440.356630858 5061280.821917198))’, 0) AND ST_Intersects(“geom”, ST_GeomFromText(‘POLYGON ((-10701440.356630858 5061280.821917198, -10700675.986348007 5061280.821917198, -10700675.986348007 5060516.45163436, -10701440.356630858 5060516.45163436, -10701440.356630858 5061280.821917198))’, 0)) AND ((“tot_avg__5” > 0 AND “tot_avg__5” <= 4) OR (“tot_avg__5” > 4 AND “tot_avg__5” <= 5) OR (“tot_avg__5” > 5 AND “tot_avg__5” <= 6) OR (“tot_avg__5” > 6 AND “tot_avg__5” <= 7) OR (“tot_avg__5” > 7 AND “tot_avg__5” <= 8) OR (“tot_avg__5” > 8 AND “tot_avg__5” <= 9) OR (“tot_avg__5” > 9 AND “tot_avg__5” <= 10) OR (“tot_avg__5” > 10 AND “tot_avg__5” <= 20))) LIMIT 3) gt_limited_
As you can see, the SRID in the ST_GeomFromText functions is 0. When I manually change the SRID in the query to 3857 (which is the SRID of the layer), I can run the query successfully. The entry in geometry_columns is correct (3857). It also matches the geom column in my traffic_scenario_a table.
How can I fix this so that GeoServer uses the correct SRID in this query?
Bettina Lechner
blechner@…6560…