0

i use two seperate datasource for my layers:

  • sql database for main map data, this is using EPSG:900913
  • osm file for some extra features, this data use EPSG:4326 projection

tiles for both layers are created on server side. what i need to do to generate tiles for EPSG:900913 projection from data in EPSG:4326 projection? is it somewhere in tilecache configuration? in definition map or layer in osm file, or somewhere else?

tilecache.cfg

[test]
type=Mapnik
mapfile=/var/www/tc/osm/test.xml
tms_type=google
layers=global

test.xml

<Map background-color="#00000000" srs="+proj=latlong +ellps=WGS84 +datum=WGS84 +no_defs" >
  <Style name="style">
    <Rule>
      <PolygonSymbolizer fill="#ff0000" />
      <LineSymbolizer stroke="#00ff00" stroke-width="100" />
    </Rule>
  </Style>
  <Layer name="global" srs="+proj=latlong +ellps=WGS84 +datum=WGS84 +no_defs" status="on">
  <StyleName>style</StyleName>
  <Datasource>
      <Parameter name="type">osm</Parameter>
      <Parameter name="file">/var/www/tc/osm/test.osm</Parameter>
    </Datasource>
  </Layer>
</Map>

test.osm

<osm version='0.6' upload='true' generator='JOSM'>
  <node id='-186' action='modify' visible='true' lat='50.0' lon='50.0' />
  <node id='-184' action='modify' visible='true' lat='50.0' lon='-50.0' />
  <node id='-182' action='modify' visible='true' lat='-50.0' lon='-50.0' />
  <node id='-180' action='modify' visible='true' lat='-50.0' lon='50.0' />
  <way id='-91' action='modify' visible='true'>
    <nd ref='-186' />
    <nd ref='-184' />
    <nd ref='-182' />
    <nd ref='-180' />
    <nd ref='-186' />
  </way>
</osm>

map.html

...
var   map = new OpenLayers.Map ("map", {
                controls:[
                    new OpenLayers.Control.MousePosition(),                    
              numZoomLevels:zoomLev,
                maxResolution: 156543.0339,
                units: 'm',
                projection: new OpenLayers.Projection("EPSG:900913"),
                maxExtent: new OpenLayers.Bounds(-20037508.34, -20037508.34, 20037508.34, 20037508.34),
                displayProjection: new OpenLayers.Projection("EPSG:4326")
            } );

var test = new OpenLayers.Layer.WMS( "test", "http://localhost/tc/tilecache.cgi?",
    {layers: 'level_1', format: 'image/png'}, { isBaseLayer: false} );
...

1 Answer 1

1

you can do it on your tilecache.cfg configuration file to changing tms_type parameter to #tms_type=google... you can get some information here...

tms_type
    Setting this to “google” will cause tiles to switch vertical order (that is, 
    following the Google style x/y pattern).

i hope it helps you...

1
  • that sound reasonable, but its not working. actually i dont have my layer at all.
    – user902383
    May 28, 2012 at 16:18

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.