Thank you Dane.  I ended up just creating all the layer definitions by hand, 
one for each state directory, and set them to reference a single layer style.  
Not elegant, but it works fine.
Thanks for the tip.
Mark

On Jul 7, 2011, at 2:44 PM, Dane Springmeyer wrote:

> On Jul 7, 2011, at 2:16 PM, Mark Vahrenwald wrote:
> 
>> Hi all,
>> I'm in the process of building a Mapnik tile cache from a dataset of 
>> shapefiles.  The file path to my datasources is hard-coded, and the data 
>> itself is broken down in separate folders by state with the state 
>> abbreviation as part of the file name (an example file path:  
>> "../shapefiles/US/CA/CArivers.shp").  The result of this is that I can 
>> render individual states, but I'm not able to render multiple states 
>> together because the datasource only allows me to point to one state 
>> directory at at time.
>> Given that this is a standard method of file structure for TomTom/Navteq 
>> datasets, I'm assuming there's a work-around out there, but I haven't come 
>> across it yet.  Thanks in advance for any suggestions.
>> Mark
> 
> Mark,
> 
> Generally if you have more than one shapefile you want to show, then you 
> would create another layer definition for that datasource. As mapnik supports 
> named styles you would then be able to create one style and apply that style 
> to all the layers needed.
> 
> If the # of individual shapefiles is enough that creating all those layers 
> one by one is overly tedius, then perhaps you could just write a simple 
> script to loop through each directory and author the chunk of Mapnik XML 
> needed to declare each as a layer.
> 
> Generally hundreds of layers in an XML is still quite fast (after the initial 
> XML load is finished) because each layer's individual bounding box will be 
> cached by mapnik and when rendering only those layers that intersect with a 
> tile's extent will be queried. 1000's of layers would also likely work fine 
> rendering if you could script the creation of the map document.
> 
> Now, if you are using some other tool, like TileMill to author your 
> stylesheets, then scripting Mapnik XML is not as straighforward (though in 
> the case of TileMill you could script the creation of the mml file which is 
> just a JSON version of Mapnik's XML). In this case you might be better off 
> scripting the union of a group of shapefiles that all have the same schema 
> into one or several larger shapefiles. I would use ogr's --append function 
> for this task, but ogr's VRT support could also come in quite handy: 
> http://www.gdal.org/ogr/drv_vrt.html
> 
> Does that help?
> 
> Dane

_______________________________________________
Mapnik-users mailing list
[email protected]
https://lists.berlios.de/mailman/listinfo/mapnik-users

Reply via email to