I am trying to create a google earth like wep application. My problem is that I can't get to render a full view of the earth.
The zoom_all()
function generates the following error :
RuntimeError: could not zoom to combined layer extents using zoom_all because proj4 could not back project any layer extents into the map srs (set map 'maximum-extent' to override layer extents)
And if I define an envelope, I can only manage to have a cropped view of the earth with
mapnik.Envelope(-4500000, -4500000, 4500000, 4500000)
or a blank image with
mapnik.Envelope(-4600000, -4600000, 4600000, 4600000)
EDIT : I also tried specifying maximum-extent
in the xml file but the result was the same as specifying the envelope in the python script.
What am I doing wrong ? Any hint will be appreciated :)
My configuration is :
- WGS84 shapefile coastlines-split-4326.zip (http://openstreetmapdata.com/data/coastlines)
- mapnik 2.2.0-pre
- archlinux
This is the python script that renders the image :
#!/usr/bin/python2
import mapnik
image = 'world-xml.png'
map_config = 'world.xml'
m = mapnik.Map(1000, 1000)
mapnik.load_map(m, map_config)
bbox = mapnik.Envelope(-4500000, -4500000, 4500000, 4500000)
m.zoom_to_box(bbox)
mapnik.render_to_file(m, image)
And this is the xml config file :
<Map background-color="#ffffff" srs="+proj=ortho +lat_0=0 +lon_0=0 +ellps=WGS84 +units=m +x_0=0 +y_0=0 +no_defs">
<Style name="projet-carte">
<Rule>
<PolygonSymbolizer fill="#ffffff" />
<LineSymbolizer stroke="#000000" stroke-width="0.1" />
</Rule>
</Style>
<Layer name="world" srs="+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs">
<StyleName>projet-carte</StyleName>
<Datasource>
<Parameter name="type">shape</Parameter>
<Parameter name="file">lines.shp</Parameter>
</Datasource>
</Layer>
</Map>