Hi List- I've run into an issue with coordinates not matching with a shapefile between the standard GIS (ArcGIS or QGIS) and the MousePosition() readout in openlayers. Could mapnik be rendering the tiles incorrectly, or is this solely a problem with the extent/bbox settings in the tilecache.cfg or openlayers.js? I'm a little confused about how to set up the extents/bbox settings to make sure that everything "lines up".
My method for determining the extents/bbox for the tilecache.cfg and the openlayers js is to run ogrinfo on the shapefile, and then use the extents produced. here are the relevant chunks of code: - from* ogrinfo: * Extent: (272314.927338, 5193839.750340) - (272767.950602, 5194122.421423) Layer SRS WKT: PROJCS["WGS_1984_UTM_Zone_12N" > > , > GEOGCS["GCS_WGS_1984", > DATUM["WGS_1984", > SPHEROID["WGS_1984",6378137.0,298.257223563]], > PRIMEM["Greenwich",0.0], > UNIT["Degree",0.0174532925199433]], > PROJECTION["Transverse_Mercator"], > PARAMETER["False_Easting",500000.0], > PARAMETER["False_Northing",0.0], > PARAMETER["Central_Meridian",-111.0], > PARAMETER["Scale_Factor",0.9996], > PARAMETER["Latitude_Of_Origin",0.0], > UNIT["Meter",1.0]] > > > - And the* tilecache.cfg* > > [utm] > type=Mapnik > mapfile=/mapnik/demo/python/mapfile.xml > srs=EPSG:32612 > projection= +proj=utm +zone=12 +ellps=WGS84 +datum=WGS84 +units=m +no_defs > bbox=272314.927338, 5193839.750340,272767.950602, 5194122.421423 > data_extent=272314.927338, 5193839.750340,272767.950602, 5194122.421423 > > > - And the *openlayers js* > > <script src="http://dev.openlayers.org/nightly/OpenLayers.js"></script> > <script type="text/javascript"> > var map = null; > function init() { > map = new OpenLayers.Map($('map'), > { controls: [], > maxResolution: 360/512, > projection: new OpenLayers.Projection("EPSG:32612") , > numZoomLevels: 20, > minZoomLevel: 0, > maxZoomLevel: 20, > maxExtent: new > OpenLayers.Bounds(272314.927338,5193839.750340,272767.950602,5194122.421423), > }); > var base = new OpenLayers.Layer.TMS("TileCache Mapnik Layer > via TMS", > "http://localhost/tilecache/tilecache.py/", { > serviceVersion: "1.0.0", layername: "utm", type: "png?FORCE=1" }); > var tilecache = new OpenLayers.Layer.TileCache( > "TileCache Server Static Cache (only if exists)", " > http://localhost/cache", > "utm", { format: "image/png", }); > > map.addLayers([base, tilecache]); > map.setBaseLayer(base); > > map.addControl(new OpenLayers.Control.Navigation()); > map.addControl(new OpenLayers.Control.MousePosition()); > map.addControl(new OpenLayers.Control.PanZoom()); > map.addControl(new OpenLayers.Control.Permalink()); > map.addControl(new OpenLayers.Control.LayerSwitcher()); > var campus = new > OpenLayers.Bounds(272314.927338,5193839.750340,272767.950602,5194122.421423) > map.zoomToExtent(campus); > map.zoomToMaxExtent(); > map.addLayer(new OpenLayers.Layer.GML("GML", > "../gml/mainhall_UTM.gml")); > } > </script> > > - from *mapfile.xml*: <?xml version="1.0" encoding="utf-8"?> <Map srs="+proj=utm +zone=12 +ellps=WGS84 +datum=WGS84 +units=m +no_defs" bgcolor="#4682b4"> <Style name="base Style"> ****style stuff **** </Style> <Layer name="base" srs="+proj=utm +zone=12 +ellps=WGS84 +datum=WGS84 +units=m +no_defs" status="1" clear_label_cache="0"> <StyleName>base Style</StyleName> <Datasource> <Parameter name="file">/mapnik/demo/data/2nd_test_UTM12N</Parameter> <Parameter name="type">shape</Parameter> </Datasource> </Layer> </Map> > The offset isnt too great, but enough to throw gml layers generated via > ogr2ogr from shapefiles to be out of alignment. The gml files produced seem > to have the correct (matching) coordinate readout in the GIS and > MousePosition(). When i reproduced this map with EPSG: 4326 data and no extent settings anywhere, the coordinates matched and the GML lined up. Only when using the UTM12N data and setting the above extents is the offset produced. > > Also, here's the _extremely_ rough map that i've been working on for a > quick look at the alignment issues--gml and basemap: > http://tssmaps.ito.umt.edu/tilegoog/utm.html > > Thanks in advance for your help! > -Jamie Robertson
_______________________________________________ Mapnik-users mailing list [email protected] https://lists.berlios.de/mailman/listinfo/mapnik-users

