custom utf grid provider -- not pulling any data

52 views
Skip to first unread message

ju...@empowerengine.com

unread,
May 1, 2013, 12:35:18 PM5/1/13
to map...@googlegroups.com

Hi there,

I'm trying to make maps dynamically with colorations and features specified in a database.  I can't use a static mapnik config file, so I have to implement my own custom providers.  I also implemented a datasource factory that generates the custom sql and returns a mapnik.PostGIS datasource correctly configured.

I have a provider working that is very strongly based off of the Tilestache.Mapnik.ImageProvider class.  I couldn't inherit or decorate it, because I didn't want the constructor behavior, but I based my renderArea() code very much on the renderArea implementation.  My image provider works great.  Now I'm trying to do the same for the GridProvider, and I'm running into trouble.

When I call grid = mapnik.render_grid(map, 0, key="district_id", resolution=4), I get back a grid, but it has no data whatsoever in it.  I have set the datasource of the only layer on the map already.  

I've tried sending fields explicitly as well, and it doesn't help.  I tried to step into render_grid in the debugger, but it seems to be in a compiled library. I've also tried other options I've found on-line for constructing a new mapnik.Grid and then rendering it with render_layer or render_grid.  No luck.

It's conceivable that the error is in my datasource, though i doubt it.  If I explicitly put a SQL error into my query, it fails before I get to the rendering.  I'm running on a tiny test db, so I don't need to worry about the query being too heavy.  The datasource factory is also shared code between my two providers; only the SQL that's generated varies.  So I know it works in principle.  

My assumption is that there's just one step I'm missing, but I don't know what it is.  What do I need to set up before I call mapnik.render_grid()?

Thanks in advance

Julie

ju...@empowerengine.com

unread,
May 8, 2013, 4:17:10 PM5/8/13
to map...@googlegroups.com
For what it's worth, I solved it.  In order to be rendered, apparently every layer needs a style with at least one rule with at least one symbolizer.

Dane Springmeyer

unread,
Jul 16, 2013, 1:09:44 PM7/16/13
to map...@googlegroups.com
Hi Julie,

Sorry to miss responding to this originally. Glad you got this worked out. The grid rendering code is definitely a bit tricky and poorly documented so please don't hesitate to ping again if you have questions.

Dane

--
You received this message because you are subscribed to the Google Groups "mapnik" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mapnik+un...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Reply all
Reply to author
Forward
0 new messages