Hi Enzo,
I assume your set of points is stored in a table named "node" within
your PostGIS database. Such table would have at least:
- a "geom" column containing point geometries,
- a "radius" column containing the desired radius (type double).
If so your query will simply look like:
SELECT ST_Buffer(geom, radius)
FROM node
Your configuration file would then look like:
<Map srs="+init=epsg:XXXX">
...
<Layer name="..." srs="+init=epsg:XXXX" status="on">
<StyleName>...</StyleName>
<Datasource>
<Parameter name="type">postgis</Parameter>
<Parameter name="host">...</Parameter>
<Parameter name="port">...</Parameter>
<Parameter name="user">...</Parameter>
<Parameter name="password">...</Parameter>
<Parameter name="dbname">...</Parameter>
<Parameter name="table">(SELECT ST_Buffer(geom, radius) FROM
node) AS circles</Parameter>
...
</Datasource>
</Layer>
</Map>
I don't remember if some constraints exist on subqueries in Mapnik. If
you have a problem with this, you can still post a more concise question.
Please refer to the chapter 6 of the PostGIS documentation for more
information on spatial functions:
http://postgis.refractions.net/documentation/manual-1.3/ch06.html
Regards,
Gilles
Enzo Losantas wrote:
hey guys, i was wondering if anyone can help enlighten me on this?
i was wondering how it would be possible to draw circles on mapnik? i
was pointed earlier
to using postgis and probably use buffer function?
im thinking of trying to create circles where the radius is dynamic,
and is dependent on an attribute
of a certain set of points. how could i go about this?
by the way, thanks dave for pointing me to the right direction.
Thanks.
Enzo
---------- Forwarded message ----------
From: *Enzo Losantas* <[email protected]
<mailto:[email protected]>>
Date: Wed, Jan 7, 2009 at 3:27 PM
Subject: Re: [OSM-dev] help: drawing circles on mapnik
To: Dane Springmeyer <[email protected] <mailto:[email protected]>>
can you point me to the mapnik-users list where i can join?
as for the buffer function, the buffer distance value can be obtained
by a field in the same table? would that be possible?
also, im not familiar with the "speed bump", what would that mean?
Thanks a lot.
Enzo
On Wed, Jan 7, 2009 at 3:02 PM, Dane Springmeyer <[email protected]
<mailto:[email protected]>> wrote:
Enzo,
Yes you would use the Buffer function in PostGIS but you can
create them dynamically in your select statement within your
mapnik xml mapfile, so there is no need to pre-calculate in
another geometry field unless you need a speed bump. As of r769 in
svn trunk, mapnik's PostGIS plugin can support multiple geometry
fields.
For more info consider posting to the mapnik-users list and
reading: http://trac.mapnik.org/wiki/PostGIS
Dane
On Jan 6, 2009, at 6:45 PM, Enzo Losantas wrote:
Just a minor follow up, does this mean that im going to add
another column in my database,
use postgis to add shapefiles or buffers, then use mapnik and
render the circles properly with
the LineSymbolizer and PolygonSymbolizer?
Thanks,
Enzo
On Tue, Jan 6, 2009 at 5:13 PM, Enzo Losantas
<[email protected] <mailto:[email protected]>> wrote:
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 <[email protected]
<mailto:[email protected]>>
Subject: Re: [OSM-dev] help: drawing circles on mapnik
To: Enzo Losantas <[email protected]
<mailto:[email protected]>>
Cc: [email protected] <mailto:[email protected]>
Message-ID:
<[email protected]
<mailto:[email protected]>>
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
<[email protected] <mailto:[email protected]>>
> 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
> <[email protected] <mailto:[email protected]>> 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?
--
Check these out:
http://ohm.ecce.admu.edu.ph/
http://smart.com.ph/
--
Check these out:
http://ohm.ecce.admu.edu.ph/
http://smart.com.ph/
--
Check these out:
http://ohm.ecce.admu.edu.ph/
http://smart.com.ph/
------------------------------------------------------------------------
_______________________________________________
Mapnik-users mailing list
[email protected]
https://lists.berlios.de/mailman/listinfo/mapnik-users
--
Gilles Bassiere
MAKINA CORPUS
30 rue des Jeuneurs
FR-75002 PARIS
+33 (0) 1 44 82 00 80
http://www.makina-corpus.com
begin:vcard
fn;quoted-printable:Gilles Bassi=C3=A8re
n;quoted-printable:Bassi=C3=A8re;Gilles
org:Makina Corpus;GIS
adr;quoted-printable:;;30 rue des Je=C3=BBneurs;Paris;;FR-75011;France
email;internet:[email protected]
title:Web GIS developper
tel;work:+33 (0) 1 44 82 00 80
x-mozilla-html:FALSE
url:http://www.makina-corpus.com
version:2.1
end:vcard
_______________________________________________
Mapnik-users mailing list
[email protected]
https://lists.berlios.de/mailman/listinfo/mapnik-users