# Generate SVG maps from OSM data

O=/devel/openstreetmap/svn.openstreetmap.org/applications/rendering/osmarender

R=$O/stylesheets/osm-map-features-z17.xml


.SUFFIXES: .svg .osm .xml

# Z17 is max zoom - change is necessary
# Note the osmfile parameter is relative to the xslt script directory, not this one. 
.osm.svg:
	xsltproc  --stringparam osmfile `pwd`/$< $O/xslt/osmarender.xsl $O/stylesheets/osm-map-features-z17.xml > $@


legend.html : style2legend.py $R legendStyle.css
	python style2legend.py $R > $@

legendStyle.css: $R css-svg-to-html.sed
	sed -f css-svg-to-html.sed < $R > $@


# looking at the very corners of the town gies these permalinks:
# http://openstreetmap.org/?lat=42.475&lon=-71.2543&zoom=14&layers=B000FTF
# http://openstreetmap.org/?lat=42.4118&lon=-71.1723&zoom=14&layers=B000FTF
# these need to be given in the order
# left, bottom, right, top
lexington.osm :
	curl "http://api.openstreetmap.org/api/0.5/map?bbox=-71.2543,42.4118,-71.1723,42.475" > $@


area.txt :
	grep "<area class=" $R | sed -e 's?^.* class="\([^"]*\)".*?\1?'| sort -u | grep -v highway > $@

highway.txt :
	grep "<area class=" $R | sed -e 's?^.* class="\([^"]*\)".*?\1?'| sort -u | grep highway > $@


