Have you set the correct tile size in openlayers? The resolution it is showing is double the max resolution. This is probably because openlayers is generating extents based on a particular tile size. If this size does not match what tilecache is using the resulting resolution that tilecache calculates based on your extents will be wrong. Try explicitly setting the tile size in both openlayers and tilecache to make sure.
Matthew -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Justin Palk Sent: 05 June 2008 15:13 To: [email protected] Subject: [OpenLayers-Users] wms query frustration Hi all -- I'm just starting out with openlayers, and I'm a little frustrated. I've been trying for a few days now to set up a simple map that will let me query some hypothetical election results, but I keep running into two snags: 1) When I first go to my test.html page, I'll get: "An error occurred: can't find resolution index for 0.002231. Available resolutions are: [0.0011154260000000001, 0.00055771300000000005, 0.00027885650000000002, 0.00013942825000000001 (etc.)" I can't figure out why I'm starting at a resolution of 0.002231 when I set a maxResolution of 0.001115426. 2) If I zoom in one step (to resolution 0.001115426) I get the following error: "An error occurred: Current x value -77.535047 is too far from tile corner x -77.677821" The "Current x value" never seems to change regardless of where I click on the map. I can only assume this is some sort of projection error, but I've been beating my head against the wall checking and double-checking my srs's and resolutions, but I can't seem to find a solution. Any suggestions would be greatly appreciated. I'm working with a map in EPSG:4326 ogrinfo -so returns: INFO: Open of `election_4326.shp' using driver `ESRI Shapefile' successful. Layer name: election_4326 Geometry: Polygon Feature Count: 61 Extent: (-77.677821, 39.219771) - (-77.106723, 39.719845) Layer SRS WKT: GEOGCS["GCS_WGS_1984", DATUM["WGS_1984", SPHEROID["WGS_1984",6378137,298.257223563]], PRIMEM["Greenwich",0], UNIT["Degree",0.017453292519943295]] ED_NUM: Integer (10.0) ED_NAME: String (16.0) PRECINCT: String (6.0) LEGIS_DIST: String (3.0) POLL_NAME: String (50.0) POLL_TYPE: String (40.0) POLL_ADDRE: String (40.0) CITY: String (25.0) ZIP_CODE: String (15.0) SHAPE_area: Real (19.11) SHAPE_len: Real (19.11) Here's the relevant bit from my tilecache.cfg: [election_results] type=MapnikLayer mapfile=/tmp/ed.xml extent_type=loose bbox=-77.677821,39.219771,-77.106723,39.719845 maxResolution = 0.001115426 The map line from ed.xml: <Map bgcolor="steelblue" srs="+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs"> and my script: <script type="text/javascript"> OpenLayers.ProxyHost = "/cgi-bin/proxy.cgi?url="; var map = new OpenLayers.Map("map", {maxExtent: new OpenLayers.Bounds(-77.677821,39.219771,-77.106723,39.719845), maxResolution:0.001115426} ); var er = new OpenLayers.Layer.WMS("election_results", "http://127.0.0.1/cgi-bin/tilecache-2.03/tilecache.cgi?", {layers: 'election_results', format: 'image/png', projection: "EPSG:4326"}); map.addLayer(er); map.addControl(new OpenLayers.Control.Permalink()); map.zoomToMaxExtent(); map.events.register('click', map, function (e){ OpenLayers.Util.getElement('nodeList').innerHTML = "Loading..."; var url = er.getFullRequestString({ REQUEST: "GetFeatureInfo", EXCEPTIONS: "application/vnd.ogc.se_xml", BBOX: er.map.getExtent().toBBOX(), X: e.xy.x, Y: e.xy.y, INFO_FORMAT: 'text/html', OUERY_LAYERS: er.params.LAYERS, WIDTH: er.map.size.w, HEIGHT: er.map.size.h}); OpenLayers.loadURL(url, '', this, setHTML); OpenLayers.Event.stop(e); } ); function setHTML(response){ OpenLayers.Util.getElement('nodeList').innerHTML = response.responseText; } </script> -- "News is what people want to keep hidden, and everything else is publicity" --Bill Moyers _______________________________________________ Users mailing list [email protected] http://openlayers.org/mailman/listinfo/users This e-mail message and any attached file is the property of the sender and is sent in confidence to the addressee only. The contents are not to be disclosed to anyone other than the addressee. Unauthorised recipients are requested to preserve this confidentiality and to advise the sender immediately of any error in transmission. If you experience difficulty with opening any attachments to this message, or with sending a reply by email, please telephone on + 44-(0)1235 438151 or fax on + 44-(0)1235 438188. Any advice contained in this e-mail or any accompanying file attached hereto is for information purposes only. RPS do not take any responsibility for differences between the original and the transmission copy or any amendments made thereafter. If the addressee requires RPS to be responsible for the contents of this e-mail, RPS will be pleased to issue a signed hard copy of the document upon request. RPS Group Plc, company number: 208 7786 (England). Registered office: Centurion Court, 85 Milton Park Abingdon Oxfordshire OX14 4RY. RPS Group Plc web link: <http://www.rpsgroup.com> _______________________________________________ Users mailing list [email protected] http://openlayers.org/mailman/listinfo/users
