Created
March 20, 2015 23:49
-
-
Save gileri/3df89cc2811d16549e45 to your computer and use it in GitHub Desktop.
OSM phone number normalisation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
osmosis \ | |
--fast-read-xml file="out.xml" \ | |
--buffer \ | |
--sort \ | |
--read-pbf-fast file="lyon_france.osm.pbf" \ | |
--sort \ | |
--buffer \ | |
--derive-change \ | |
--log-progress-change \ | |
--write-xml-change file="change.osc" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
osmosis \ | |
--read-pbf-fast file="lyon_france.osm.pbf" \ | |
--buffer \ | |
--tag-transform file="transform.xml" \ | |
--log-progress \ | |
--buffer \ | |
--write-xml file="out.xml" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0"?> | |
<translations> | |
<translation> | |
<name>French phone numbers normalisation</name> | |
<description>French phone numbers normalisation</description> | |
<match> | |
<tag k="phone|contact:phone" match_id="phone1" v=".*(\d).*?(\d).*?(\d).*?(\d).*?(\d).*?(\d).*?(\d).*?(\d).*?(\d)"/> | |
</match> | |
<output> | |
<copy-all/> | |
<tag from_match="phone1" v="+33 {1} {2}{3} {4}{5} {6}{7} {8}{9}"/> | |
</output> | |
</translation> | |
</translations> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Allow to quickly see defects post-transformation, before deriving the osc file | |
sed -ne 's/.*k=\"\(contact:\)*phone\" v=\"\(.*\)\".*/\2/p' out.xml | sort | uniq | less |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment