[OSM-dev] help: drawing circles on mapnik

Enzo Losantas joselorenzo at gmail.com
Tue Jan 6 09:13:44 GMT 2009


Anyone knowledgeable on how to go about this?

Dane, i was thinking of maybe going about this with a buffer maybe?
If i have a point, then i could use that point as the center of the buffer,
then this buffer can be the circle that i am looking for. there seems to be
a
buffer function that postgis offers.. is that correct?

Thanks,
Enzo

----
Date: Sun, 16 Nov 2008 21:15:43 -0800
From: Dane Springmeyer <blake at hailmail.net>
Subject: Re: [OSM-dev] help: drawing circles on mapnik
To: Enzo Losantas <joselorenzo at gmail.com>
Cc: dev at openstreetmap.org
Message-ID: <8B247371-31C0-467F-BD98-ECDCD462F9AF at hailmail.net>
Content-Type: text/plain; charset="us-ascii"

Hi Enzo,

I'd second Andy's recommendation of using PostGIS to render circles
with varying size based on some attribute. That sounds like the right
place to start.

As far as styling the circles once you've created them can find more
about the LineSymbolizer (which you can use to define the outline size
and color of the circle), and the PolygonSymbolizer (to define the
fill color) on the Mapnik wiki:

http://trac.mapnik.org/wiki/LineSymbolizer
http://trac.mapnik.org/wiki/PolygonSymbolizer

Also at the wiki is a page that has started to document some usage
specific to PostGIS:

http://trac.mapnik.org/wiki/PostGIS#Usage

And here is a sample script in python that shows buffering existing
polygon data into a larger polygon using PostGIS:
http://mapnik-utils.googlecode.com/svn/trunk/tutorials/postgis/postgis_geometry.py

You could likely borrow from some of the script ideas to approximate
the same effect with circles.

Where these references are incomplete or unclear I'll try to answer
further.

Dane




On Nov 16, 2008, at 7:40 PM, Enzo Losantas wrote:

> Thanks Andy for replying.. somehow gave me an idea how it works.
>
> although there are still things that im confused about. as for the
> kind of circles, maybe circles that have dynamic
> radius based on a certain parameter. Since these are varying radii,
> I'll probably follow your advice regarding
> drawing polylines in postgis.
>
> As for the item on LineSymbolizer / PolygonSymbolizer, can you help
> me with this? Are there any available
> API or references that can be of help as well? How does this work
> exactly?
>
> thanks,
> Enzo
>
> On Wed, Nov 12, 2008 at 8:16 PM, Andy Allan <gravitystorm at gmail.com>
> wrote:
> What kind of circles are you looking for? If you just want small
> circles to mark point locations, then make a .png and use a
> PointSymbolizer with it. But if you're trying to vary the size of the
> circles, like for example "draw me a circle where the radius is
> proportional to the population of the town", then you'd be better off
> creating polylines in postgis (or shapefile) and then just
> LineSymbolizer / PolygonSymbolizer depending on whether you want the
> outline or it filled.
>
> Cheers,
> Andy
>
> On Wed, Nov 12, 2008 at 2:54 AM, Enzo Losantas
> <joselorenzo at gmail.com> wrote:
> > hello,
> >
> > im wondering if anyone here is familiar with rendering osm through
> mapnik?
> > Particularly, anyone knows how to render circles? is it through
> node-ways or
> > it can be done through the rules?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/dev/attachments/20090106/f788fde5/attachment.html>


More information about the dev mailing list