source: subversion/applications/utils/change_tags/massgis.py @ 13046

Last change on this file since 13046 was 13046, checked in by crschmidt, 11 years ago

be smarter with national, state parks; don't crash on golfcourses without
existing leisure tags.

File size: 2.1 KB
Line 
1__version__ = "0.1"
2
3def conservation_organization(tags, type):
4    """Fix for a MassGIS OpenSpace todo: typo in 'conservation_organization'
5       in bulk import.
6    """
7   
8    if type == "node":
9        return False 
10   
11    changed = False
12   
13    if 'ownership' in tags and tags['ownership'] == 'conservation_rganization':
14        tags['ownership'] = 'conservation_organization'
15        changed = True
16   
17    tags['created_by'] = 'change_tags.py - massgis %s' % __version__
18
19    return changed   
20
21def area_names(tags, type):
22    """Fix for MassGIS OpenSpace areas: do better keying based on name, fix some common typos."""
23   
24    changed = False
25   
26    if type == "way" and 'name' in tags:
27        name = tags['name']
28       
29        # Common playground typos
30        if name.endswith("Plgd"):
31            name = name.replace("Plgd", "Playground")
32            tags['name'] = name
33            changed = True
34        elif name.endswith("Plygrd"):
35            name = name.replace("Plygrd", "Playground")
36            tags['name'] = name
37            changed = True
38        elif name.endswith("Playgroung"):
39            name = name.replace("Playgroung", "Playground")
40            tags['name'] = name
41            changed = True
42       
43        if name.endswith("Golf Course"):
44            if not 'leisure' in tags or tags['leisure'] != "golf_course":
45                changed = True
46                tags['leisure'] = "golf_course"
47                if 'landuse' in tags:
48                    del tags['landuse']
49        elif name.endswith("State Park"):
50            if not 'leisure' in tags or tags['leisure'] != "nature_reserve":
51                changed = True
52                tags['leisure'] = 'nature_reserve'
53               
54        elif (name.endswith("Park") and tags['massgis:FEE_OWNER'] != "National Park Service") \
55                or name.endswith("Playground") or name.endswith("Field"):
56            if not 'leisure' in tags or tags['leisure'] != "park":
57                changed = True         
58                tags['leisure'] = "park"
59
60    tags['created_by'] = 'change_tags.py - massgis area_names %s' % __version__
61
62    return changed   
Note: See TracBrowser for help on using the repository browser.