Skip to content

Instantly share code, notes, and snippets.

@maxerickson
Last active November 2, 2017 00:10
Show Gist options
  • Save maxerickson/3a497383bf0f1094668db7f4658460b8 to your computer and use it in GitHub Desktop.
Save maxerickson/3a497383bf0f1094668db7f4658460b8 to your computer and use it in GitHub Desktop.
# -*- coding: utf8 -*-
# mapping for Carreteras estatales found
# at http://www2.pr.gov/agencias/gis/descargaGeodatos/Infraestructuras/Pages/Transportaci%C3%B3n.aspx
# more documentation at http://wiki.openstreetmap.org/wiki/Puerto_Rico_Projects/Puerto_Rico_TIGER_Fixup
#
# need to delete one feature because of character encoding issues.
# ogrinfo -dialect SQLite -sql "delete from g35_viales_carreteras_estatales_julio_2015 where objectid==2022" /share/gis/prhta
road_map={
"Red Primaria Urbana Paseo Peatonal":"footway",
"Camino Municipal Rotulado":"unclassified",
"Intermodal":"unclassified",
"Conector":"unclassified",
"Red Terciaria":"tertiary",
"Rampa Red Terciaria":"tertiary_link",
"Red Secundaria":"secondary",
"Rampa Red Secundaria":"secondary_link",
"Red Primaria":"primary",
"Red Primaria Urbana":"primary",
"Red Primaria Urbana2":"primary",
"Rampa Red Primaria":"primary_link",
"Rampa Red Primaria Urbana":"primary_link",
"Autopista":"motorway",
"Red Propuesta":"proposed",
"Red Secundaria en Diseño":"proposed",
"Red Secundaria Propuesta":"proposed",
"Red Primaria Propuesta":"proposed",
"Red Primaria Urbana Propuesta":"proposed",
"Autopista Propuesta":"proposed",
"Autopista Propuesta2":"proposed"
}
proposed_map={
"Red Propuesta":"tertiary",
"Red Secundaria en Diseño":"secondary",
"Red Secundaria Propuesta":"secondary",
"Red Primaria Propuesta":"primary",
"Red Primaria Urbana Propuesta":"primary",
"Autopista Propuesta":"motorway",
"Autopista Propuesta2":"motorway"
}
def filterTags(attrs):
if not attrs:
return
tags = {}
if attrs["num_carre"]:
tags["ref"]="PR-%s" % attrs["num_carre"]
if attrs["clasific"]:
tags["highway"]=road_map[attrs["clasific"]]
if tags["highway"]=="proposed":
tags["proposed"]=proposed_map[attrs["clasific"]]
return tags
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment