[Tilecache] Projecting with a different SRS

Tyler Durden tylersticky at gmail.com
Thu Aug 28 05:10:44 EDT 2008


Hi Dane,
It only shows empty tiles.

I've have in tilecache.cfg:

[portugal]
type=MapnikLayer
mapfile=/home/tyler/projects/maps/tilecache/osm.xml
bbox=3089108, -3605741, 5546528, -558188
maxResolution=1411.113933339
resolutions=1411.113933339, 705.556966669, 352.778483335,
176.389241667, 88.194620834
srs=EPSG:3395
projection=+proj=merc +lon_0=0 +k=1.000000 +x_0=0 +y_0=0 +ellps=WGS84
+datum=WGS84 +units=m +no_defs
extent_type=strict
levels=10
extension=png
debug=no
size=256,256


In my osm.xml(Mapnik):
<Map bgcolor="&color_water;" srs="+proj=merc +k=1.0 +datum=WGS84 +over
+units=m +no_defs">
...
<Layer name="a7" status="on" srs="+proj=merc +datum=WGS84 +over
+units=m +no_def">
...
</Layer>


In the javascript(OpenLayers):

var bbox = new OpenLayers.Bounds(3089108, -3605741, 5546528, -558188);
var options = {
   numZoomLevels : 10,
   projection    : "EPSG:3395",
   maxResolution : 1411.113933339,
   resolutions   : [1411.113933339, 705.556966669, 352.778483335,
176.389241667, 88.194620834],
   units: "m",
   maxExtent     : bbox};

var map = new OpenLayers.Map("map", options);
var layer = new OpenLayers.Layer.WMS("world",
"http://192.168.1.168:8080/", {layers: "world"});
map.addLayer(layer);
map.zoomToMaxExtent();

On Wed, Aug 27, 2008 at 8:54 PM, Dane Springmeyer <blake at hailmail.net> wrote:
> Tyler,
>
> In your tilecache.cfg you can pass a parameter like:
>
> projection=+proj=merc +k=1.0 +datum=WGS84 +over +units=m
>
> which will override the projection in the mapnik XML and reproject your data
> to that projection.
>
> Or you can do as it sounds like you've done and just change the proj4 code
> in your original XML.
>
> Either way the only other step needed to fetch projected tiles through
> TileCache should be to set the proper extents in OpenLayers.
>
> I'm not clear on the smartest way to do this but in my tilecache.cfg I have:
>
> [polar]
> type=Mapnik
> mapfile=/Library/WebServer/Documents/mapfile.xml
> srs=EPSG:3031
> projection= +proj=stere +lat_0=-90 +lat_ts=-71 +lon_0=0 +k=1 +x_0=0 +y_0=0
> +ellps=WGS84 +datum=WGS84 +units=m +no_defs
> bbox=-3721203.143138902,-951869.332207036,
> 3560164.0478620003,1844986.6977515414
>
> the bbox which nests inside the maxextent specified in the OpenLayers map
> options that read:
> ...
> projection: new OpenLayers.Projection("EPSG:3031") ,
> maxExtent: new OpenLayers.Bounds(-196813697.178490, -100120989.481879,
> 160561884.749931,191038283.027071)
> ...
>
> then call map.zoomToMaxExtent(); somewhere lower in the page and you should
> be rendering projected tiles of your data in OpenLayers.
>
> Cheers,
>
> Dane
>
>
>
> On Aug 27, 2008, at 1:48 AM, Tyler Durden wrote:
>
>> I've in my geoms fields(Postgis) in WSG84(EPSG:4326) and I want to
>> make the projection and generate the tiles with TileCache to World
>> Mercator(EPSG:3395), althougth I've srs=EPSG:3395 in my tilecache.cfg
>> it doesn't convert.
>> I'm using TileCache, OpenLayers and Mapnik. In my Mapnik osm.xml I've:
>> <Map bgcolor="&color_water;" srs="+proj=merc +k=1.0 +datum=WGS84 +over
>> +units=m">
>>
>> This conversion is possible? Or I've must have the geoms in EPSG:3395?
>>
>> Thanks,
>> Tyler
>> _______________________________________________
>> Tilecache mailing list
>> Tilecache at openlayers.org
>> http://openlayers.org/mailman/listinfo/tilecache
>
>



More information about the Tilecache mailing list