I have been using mapnik for a while with a rather small PostGIS database.
Recently, my database became significantly larger (currently about 8 million
geometries),
and I am now seeing calls to render() being very slow (20-30 seconds).
I believe my database is properly indexed, and I've noticed that mapnik's
queries run extremely quickly. For example:
SELECT AsBinary("geometry",'NDR') AS geom,"color","nohood" from (select
geometry, color, 1 as nohood from web_plotgeometry WHERE neighborhood_id=1)
as web_plotgeometry WHERE "geometry" && SetSRID('BOX3D(-122.1830749511719
37.47703779669804,-122.1817016601562 37.4781276287212)'::box3d, 4326);
executes almost instantly.
Furthermore, my features are not very complex, and the tiles I am generating
don't have a lot of features on them
(roughly dozens, usually). So I'm wondering if anyone has hints on where
the slowdown is
At a basic level, here is the relevant part of my code.
Thanks for looking!
David
---------------
lyr = Layer('Neighborhood, '+init=epsg:4326')
lyr.datasource = PostGIS(host='localhost', user='postgres', password='',
dbname='nextdoor',
table='(select geometry, color, 1 as snohood from
web_plotgeometry WHERE neighborhood_id=%s) as web_plotgeometry' % hood.id)
map_obj = Map(int(query['WIDTH']), int(query['HEIGHT']), '+init=epsg:3857')
map_obj.append_style('color', self.style) # self.style is a very simple
style with 3 rules.
bbox = map(float, query['BBOX'].split(','))
map_obj.zoom_to_box(Envelope(*bbox))
image = Image(int(query['WIDTH']), int(query['HEIGHT']))
# SLOW
render(map_obj, image)
png_data = image.tostring(common.PIL_TYPE_MAPPING[query['FORMAT']])
return png_data
_______________________________________________
Mapnik-users mailing list
[email protected]
https://lists.berlios.de/mailman/listinfo/mapnik-users