Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

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 :

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>
share|improve this question
add comment

1 Answer 1

The ortho projection does not cover the whole world, only the visible half.

Using the QGIS GUI, your globe would look like this:

enter image description here

What you see as nasty artefacts will kill the python script.

So you have to clip the world to the vsisble extent.

See these Q&A for more advice:

Where did the polygons go after projecting a map in QGIS?

Ortho Projection produces artifacts

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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