CivicMaps Tile Engine v0.5 |
![]() |
HTML HEAD SCRIPT type="text/javascript" src="tile.js" SCRIPT
DIV id="tiles1" style="border: blue 2px dashed; WIDTH: 512px; HEIGHT: 256px;" DIV SCRIPT new tile_engine_new( 'tiles1', 'FIT', 'local_url_to_your_feed.xml', 'http://civicmaps.org/cgi-bin/mapserv?map=/www/sites/civicmaps.org/maps/world.map&service=WMS&WMTVER=1.0.0&REQUEST=map&SRS=EPSG:4326&LAYERS=bluemarble,landsat7,lakes,rivers,cities,majorroads,minorroads,tiger_polygon,tiger_landmarks,tiger_lakes,tiger_local_roads,tiger_major_roads,lowboundaries,boundaries,coastlines&FORMAT=image/jpeg&STYLES=&TRANSPARENT=TRUE', 0,0,0,0,0 ); SCRIPT
# ogrinfo -summary -ro gltp:/vrf/z:/p2p/geodata/vmap/v0noa/vmaplv0/noamer
for file in $( cat summary.info )
do
emit=${file%@*}
echo "generating layer $file"
rm one.shp two.shp tre.shp for.shp
ogr2ogr one.shp gltp:/vrf/z:/p2p/geodata/vmap/v0noa/vmaplv0/noamer "$file" -nln "$emit" "$file"
ogr2ogr two.shp gltp:/vrf/z:/p2p/geodata/vmap/v0soa/vmaplv0/soamafr "$file" -nln "$emit" "$file"
ogr2ogr tre.shp gltp:/vrf/z:/p2p/geodata/vmap/v0eur/vmaplv0/eurnasia "$file" -nln "$emit" "$file"
ogr2ogr for.shp gltp:/vrf/z:/p2p/geodata/vmap/v0sas/vmaplv0/sasaus "$file" -nln "$emit" "$file"
echo "merging $emit"
ogr2ogr "$emit.shp" one.shp -nln "$emit" one
ogr2ogr -update -append "$emit.shp" two.shp -nln "$emit" two -nln "$emit" "$file"
ogr2ogr -update -append "$emit.shp" tre.shp -nln "$emit" tre -nln "$emit" "$file"
ogr2ogr -update -append "$emit.shp" for.shp -nln "$emit" for -nln "$emit" "$file"
echo "done $file"
# ogr2ogr -f PostgreSQL PG:dbname=vmap0 "$emit.shp" -lco OVERWRITE=yes
done
To prepare the tiger data I first fetched it all from the US Census as zipfiles and then
did something like this:
mkdir tiger2004fe_shpsmall for i in $( ls tiger2004fe_unzipped ); do for( j in $( ls tiger2004fe_unzipped/$i ); do echo visiting tiger/$i/$j mkdir tiger2004fe_unzip/$i/$j /opt/gdal/1.2.5/bin/ogr2ogr -f "ESRI Shapefile" -t_srs EPSG:4326 tiger2004fe_shpsmall/$i/$j tiger2004fe_unzip/$i/$j done doneAnother thing that can be done above is to run a shapetree over each of the shapefiles. This incantation is something like "shptree filename.shp" and helps mapserver to deal with large shapefiles. I did not do this but may do so later. Schulyer manufactured polygons over tiger using a python based tool. I don't document this process here yet but may do so perhaps later. You can google for it. Polygons are not needed but are nice to have. Then I ran a tile index generator over the whole thing so that mapserver could be efficient:
for i in $( ls tiger2004fe_shpsmall ); do for( j in $( ls tiger2004fe_shpsmall/$i ); do /opt/gdal/1.2.5/bin/ogrtindex landmarks_index.shp tiger2004fe_shpsmall/$i/$j/Landmarks.shp /opt/gdal/1.2.5/bin/ogrtindex chain_index.shp tiger2004fe_shpsmall/$i/$j/CompleteChain.shp /opt/gdal/1.2.5/bin/ogrtindex names_index.shp tiger2004fe_shpsmall/$i/$j/EntityNames.shp /opt/gdal/1.2.5/bin/ogrtindex polygon_index.shp tiger2004fe_polygons/$i/$j/Polygon.shp end end
This work was sponsored and funded by Civicactions LLC who also donated the hardware and bandwidth.