Let's say for example that you have the protected areas shp file downloaded
from the geogratis website, and let's also say you have ogr2osm installed on
your computer. You could potentially download the attached file, and place
it in a folder called "translations" inside the same folder that the
shapefile is unzipped to. You could then possibly run the following command:
ogr2osm.py -t nrcan_protected protarea.shp
You could then, hypothetically, suggest any changes to the tagging.

Here's what ogr2osm found:
Detected projection metadata:
GEOGCS["GCS_WGS_1984",
    DATUM["WGS_1984",
        SPHEROID["WGS_1984",6378137.0,298.257223563]],
    PRIMEM["Greenwich",0.0],
    UNIT["Degree",0.0174532925199433]]
....
All values for attribute PROV_EN:
{'Alberta / Northwest Territories': 1, 'Ontario': 330, 'Newfoundland and
Labrador': 30, 'Saskatchewan': 196, 'Prince Edward Island': 3, 'British
Columbia': 22, 'Nova Scotia': 38, 'Quebec': 238, 'British Colombia': 287,
'Alberta': 116, 'Manitoba': 64, 'Northwest Territories': 12, 'New
Brunswick': 18, 'Nunavut': 22, 'Yukon': 21}
All values for attribute PROV_FR:
{'Alberta / Territoires du Nord-Ouest': 1, 'Territoires du Nord-Ouest': 12,
'Ontario': 330, 'Nouveau Brunswick': 2, 'Saskatchewan': 196,
'\xcele-du-Prince-\xc9douard': 3, 'Qu\xe9bec': 238, 'Nouvelle-\xc9cosse':
38, 'Colombie-Britannique': 309, 'Yukon': 21, 'Alberta': 116, 'Manitoba':
64, 'Nouveau-Brunswick': 16, 'Nunavut': 22, 'Terre-Neuve-et-Labrador': 30}

(The command line puts out hex values like \xc9, but the osm file has
accented characters)

Adam

On Tue, Jul 20, 2010 at 10:15 AM, Adam Dunn <dunna...@gmail.com> wrote:

> I was importing the boundary for E.C. Manning Prov Park and Cascades
> Recreation Area, which have so far been missing on OSM, when I realized that
> British Columbia was spelled wrong in English. This misspelling is right in
> the original shape file from
> http://geogratis.cgdi.gc.ca/geogratis/en/collection/detail.do?id=BA8D1149-7714-EC04-343B-6AFEC3BDA84A
>
> This misspelling (u versus the second o) is a common mistake made when
> confusing the spelling of the Canadian province with the spelling of the
> South American country or the English versus French spellings. This appears
> to affect every protected area imported from that file into OSM.
>
> The country:
> English: Colombia
> French: Colombie
>
> The province:
> English: British Columbia (note the u)
> French: Colombie-Britannique (note the o)
>
> What GeoGratis has:
> PROV_EN=British Colombia (note the incorrect o)
> PROV_FR=Colombie-Britannique (this is correct)
>
> Adam
>
"""
Translation rules for Natural Resources Canada - Protected Areas
"""



def translateAttributes(attrs):
	if not attrs: return
	
	tags = {}
	
	#Standard attribution and source tagging
	tags.update({'source':'NRCan Protected Areas Import 2010'})
	
	tags.update({'source:url':'http://geogratis.cgdi.gc.ca/geogratis/en/collection/detail.do?id=BA8D1149-7714-EC04-343B-6AFEC3BDA84A'})
	
	tags.update({'attribution':'Natural Resources Canada'})
	
	# Use the "NAME_EN" attribute as the name= tag
	if attrs['NAME_EN']:
		tags.update({'name':attrs['NAME_EN']})
	
	# Use the "NOM_FR" attribute as the name:fr= tag
	if attrs['NOM_FR']:
		tags.update({'name:fr':attrs['NOM_FR']})
	
	# Use the "PROV_EN" attribute as the is_in= tag
	if attrs['PROV_EN']:
		#fix the English misspelling of British Columbia
		if attrs['PROV_EN'] == 'British Colombia':
			tags.update({'is_in':'British Columbia'})
		else:
			tags.update({'is_in':attrs['PROV_EN']})
	
	# Use the "PROV_FR" attribute as the is_in:fr= tag
	if attrs['PROV_FR']:
		tags.update({'is_in:fr':attrs['PROV_FR']})
	
	# Depending on the value of TYPE, set leisure, boundary and boundary:type tags
	if attrs['TYPE'] == 'PA':
		tags.update({'boundary':'national_park'})
		tags.update({'leisure':'nature_reserve'})
		tags.update({'boundary:type':'protected_area'})
		
	elif attrs['TYPE'] == 'PRFA':
		tags.update({'boundary':'national_park'})
		tags.update({'leisure':'nature_reserve'})
		tags.update({'boundary:type':'Prairie Farm Rehabilitation Association Area'})
	
	elif attrs['TYPE'] == 'MBS':
		tags.update({'boundary':'national_park'})
		tags.update({'leisure':'nature_reserve'})
		tags.update({'boundary:type':'Migratory Bird Sanctuary'})
	
	elif attrs['TYPE'] == 'NWA':
		tags.update({'boundary':'national_park'})
		tags.update({'leisure':'nature_reserve'})
		tags.update({'boundary:type':'National Wildlife Area'})
	
	elif attrs['TYPE'] == 'NP':
		tags.update({'boundary':'national_park'})
		tags.update({'leisure':'nature_reserve'})
	
	elif attrs['TYPE'] == 'MPA':
		tags.update({'boundary':'national_park'})
		tags.update({'leisure':'nature_reserve'})
		tags.update({'boundary:type':'Marine Protected Area'})
	
	return tags
	#sys.exit()

_______________________________________________
Talk-ca mailing list
Talk-ca@openstreetmap.org
http://lists.openstreetmap.org/listinfo/talk-ca

Reply via email to