[OSM-talk] Making the sea blue in mapnik [getting there]
Jon Burgess
jburgess777 at googlemail.com
Sun Nov 4 11:20:30 GMT 2007
On Sun, 2007-11-04 at 10:20 +0100, Martijn van Oosterhout wrote:
> On 11/3/07, Jon Burgess <jburgess777 at googlemail.com> wrote:
> > A single polygon for a very large area (e.g. UK, or Europe) will have an
> > enormous number of points. This makes it really inefficient to determine
> > whether a given point is inside or outside the polygon.
>
> Well, mapnik only needs to draw it, the bounding box indicates if it
> needs to. It's true that drawing a polygon of a few hundred-thousand
> vertices take a while...
I originally thought that a single large polygon would be fine but Artem
told me that it would have to be tiled to work efficiently.
Every tile which is rendered will perform a bbox search in the DB and
will get the entire polygon geometry returned (assuming the tile is
somewhere inside the polygon).
> > What Artem did with the existing shoreline_a.shp was to slice up the
> > polygons along a square grid. The number of point within a single square
> > is quite small and is much more efficient for Postgis & Mapnik to
> > operate with.
>
> I was planning on doing this but had no idea what size grid to use.
> Any suggestions? 0.1x0.1 degree polygons would be too small, there be
> millions of them. On the other hand, rectangular polygons would be
> quick to draw, no matter what their size. Which suggests small polygon
> near coastlines and large polygons inside the landmass.
The shoreline_a was projected into mercator and those tiles use 100km
squares:-
POLYGON ((-1000000 5100000, -1000000 5200000, -900000 5200000, -900000 5100000, -1000000 5100000))
POLYGON ((-1000000 5000000, -1000000 5100000, -900000 5100000, -900000 5000000, -1000000 5000000))
POLYGON ((-900000 5100000, -900000 5200000, -800000 5200000, -800000 5100000, -900000 5100000))
POLYGON ((-900000 5000000, -900000 5100000, -800000 5100000, -800000 5000000, -900000 5000000))
This is roughly a 1x1 degree square in lat/long.
> > Artem: Is there an tool available to create tiled polygon like you did
> > with shoreline_a.shp?
>
> Perhaps there is a solution for this already, but otherwise I'll just
> have to write one...
>
> Have a nice day,
Jon
More information about the talk
mailing list