Hi John,

Envelope and Coord objects are only used to zoom or orient the map.  
They don't get rendered as shapes themselves on the map.

If you want to draw shapes on a map that do not originate from a  
datasource, then take a look into Cairo. Mapnik trunk supports both  
cairo contexts and cairo surfaces, so you can use pycairo 
(http://cairographics.org/pycairo/ 
) to draw arbitrary shapes on a context before/after rendering.

Also there is support for plotting points manually on the map surface  
via the PointDatasource, but this has not yet been extended to lines  
or polygons, and is undocumented. However you can find a script  
example here:  
http://mapnik-utils.googlecode.com/svn/example_code/memory_datasource/

Cheers,
Dane


On Mar 3, 2009, at 12:58 AM, John3478 John3478 wrote:

> Hi,
>
> I am kind of stuck how to draw rectangle line based on bbox value  
> (lower bottom and upper corner).
> There are LineSymbolizer but seems like it does not base on drawing  
> line between to point.
> There are some example from this forum that use LineSymbolizer in  
> Python but the line represent the shape
> not drawing line between two point.
>
> Thank you in advance,
> John
>
> ------------------------------------------------------------------------------------------------
>     projection = '+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0  
> +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgri...@... +no_defs  
> +over'
>     m = Map(600,300,projection)
>     m.background = Color('steelblue')
>     m.srs = projection
>     s = Style()
>     r = Rule()
>     r.symbols.append(PolygonSymbolizer(Color('#f2eff9')))
>     r.symbols.append(LineSymbolizer(Color('rgb(50%,50%,50%)'),2))
>     s.rules.append(r)
>     m.append_style('My Style',s)
>     lyr = Layer('world')
>     lyr.datasource = Shapefile(file=world_borders')
>     lyr.styles.append('My Style')
>     lyr.srs = '+proj=latlong +datum=WGS84'
>     m.layers.append(lyr)
>     p = Projection(projection)
>     lower_left_xy = p.forward(Coord(-180.0, -45.0))
>     upper_right_xy = p.forward(Coord(180.0, 80.0))
>     bbox = Envelope(lower_left_xy,upper_right_xy)
>     m.zoom_to_box(bbox)
>     render_to_file(m,'test41.png', 'png')
> _______________________________________________
> Mapnik-users mailing list
> [email protected]
> https://lists.berlios.de/mailman/listinfo/mapnik-users

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

Reply via email to