Using Mapnik tiling for just one shapefile

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Using Mapnik tiling for just one shapefile

caneta
Hi everyone.
I would like to use mapnik in order to create tiles of a shapefile.
I have downloaded the mapnik repository as described here and read how the Open Street Map engine works, but is too much for what I need.
I would like to use the OSM tiling convention, and so to use the generate_tiles.py script, but limited to my shapefile.
Do you have any hints in doing that? Or you think it is a better idea to write scripts by myself, like the working following one?
#!/usr/bin/env python
import mapnik2 as mapnik
m = mapnik.Map(400,300,"+proj=latlong +datum=WGS84")
m.background = mapnik.Color('steelblue')
s = mapnik.Style()
r=mapnik.Rule()
r.symbols.append(mapnik.PolygonSymbolizer(mapnik.Color('#f2eff9')))
r.symbols.append(mapnik.LineSymbolizer(mapnik.Color('rgb(50%,50%,50%)'),0.1))
s.rules.append(r)
m.append_style('My Style',s)
lyr = mapnik.Layer('world',"+proj=latlong +datum=WGS84")
lyr.datasource = mapnik.Shapefile(file='natural.shp')
lyr.styles.append('My Style')
m.layers.append(lyr)
m.zoom_to_box(lyr.envelope())
mapnik.render_to_file(m,'italy_nat.png', 'png')
I would prefer to reuse already written code, in order to avoid errors, but what can I eliminate from the repo files to fit my needs?
Thanks in advance.
Reply | Threaded
Open this post in threaded view
|

Re: Using Mapnik tiling for just one shapefile

Artem Pavlenko-3
Please, re-post to mapnik-group : http://mapnik.org/contact/

Artem

On 7 December 2011 10:02, caneta <[hidden email]> wrote:
Hi everyone.
I would like to use mapnik in order to create tiles of a shapefile.
I have downloaded the mapnik repository as described
http://wiki.openstreetmap.org/wiki/Mapnik#Rendering_with_Mapnik here  and
read how the Open Street Map engine works, but is too much for what I need.
I would like to use the
http://wiki.openstreetmap.org/wiki/Slippy_map_tilenames OSM tiling
convention , and so to use the generate_tiles.py script, but limited to my
shapefile.
Do you have any hints in doing that? Or you think it is a better idea to
write scripts by myself, like the working following one?
I would prefer to reuse already written code, in order to avoid errors, but
what can I eliminate from the repo files to fit my needs?
Thanks in advance.

--
View this message in context: http://gis.638310.n2.nabble.com/Using-Mapnik-tiling-for-just-one-shapefile-tp7069981p7069981.html
Sent from the Mapnik Users mailing list archive at Nabble.com.
_______________________________________________
Mapnik-users mailing list
[hidden email]
https://lists.berlios.de/mailman/listinfo/mapnik-users


_______________________________________________
Mapnik-users mailing list
[hidden email]
https://lists.berlios.de/mailman/listinfo/mapnik-users