Commit 5994b070 authored by jayherron's avatar jayherron

Added building tag maps with all unique values in dataset. Started mapping.

parent 2caa6305
......@@ -263,25 +263,29 @@
// Process a single address point.
function processAddressPoint(obj){
// Convert tags to OSM tags.
obj.set("addr:housenumber",obj.get("AddNum"));
obj.set("addr:postcode",obj.get("ZipCode"));
obj.set("addr:state",obj.get("State"));
obj.set("addr:city",capitalize(obj.get("City")));
if(obj.has("AddNum")) obj.set("addr:housenumber",obj.get("AddNum"));
if(obj.has("ZipCode")) obj.set("addr:postcode",obj.get("ZipCode"));
if(obj.has("State")) obj.set("addr:state",obj.get("State"));
if(obj.has("City")) obj.set("addr:city",capitalize(obj.get("City")));
var landmarkNa = obj.get("LandmarkNa")
if(landmarkNa != undefined && landmarkNa != "" && landmarkNa.toLowerCase() != "unknown")
obj.set("name",capitalize(landmarkNa));
var streetName = capitalize(obj.get("StreetName"));
if(obj.has("SuffixDir")){ // In this case, it's a numbered street like 900 South
var dirName = getDirName(obj.get("SuffixDir"));
streetName = streetName.concat(" ").concat(dirName);
if(obj.has("LandmarkNa")){
var landmarkNa = obj.get("LandmarkNa");
if(landmarkNa != "" && landmarkNa.toLowerCase() != "unknown")
obj.set("name",capitalize(landmarkNa));
}
else if(obj.has("StreetType")){ // In this case, it's a named street like Abc Avenue
var streetTypeName = getStreetTypeName(obj.get("StreetType"));
streetName = streetName.concat(" ").concat(streetTypeName);
if(obj.has("StreetName")) {
var streetName = capitalize(obj.get("StreetName"));
if(obj.has("SuffixDir")){ // In this case, it's a numbered street like 900 South
var dirName = getDirName(obj.get("SuffixDir"));
streetName = streetName.concat(" ").concat(dirName);
}
else if(obj.has("StreetType")){ // In this case, it's a named street like Abc Avenue
var streetTypeName = getStreetTypeName(obj.get("StreetType"));
streetName = streetName.concat(" ").concat(streetTypeName);
}
obj.set("addr:street",streetName);
}
obj.set("addr:street",streetName);
}
......
This diff is collapsed.
......@@ -2,25 +2,28 @@
var command = require("josm/command");
var console = require("josm/scriptingconsole");
// This contains all the different values of the PtType tag on the address points
const ptTypeMap = {"Agricultural":"",
"BASE ADDRESS":"",
"Business":"",
"Commercial":"",
"commercial":"",
"COMMERCIAL":"",
"Education":"",
"Government":"",
"Industrial":"",
"Med":"",
"Mixed Use":"",
"OTH":"",
"Other":"",
"OTHER":"",
"Residential":"",
"RESIDENTIAL":"",
"Unknown":"",
"Vacant":""}
// This contains all the different values of the PtType tag on the address points.
// While the address points could reference things that are not buildings, it is assumed
// that we have removed those points.
// Only specify the tags if we can be more specific than building=yes
const ptTypeMap = {"Agricultural":{"building":"farm_auxiliary"},
"BASE ADDRESS":null,
"Business":{"building":"commercial"},
"Commercial":{"building":"commercial"},
"commercial":{"building":"commercial"},
"COMMERCIAL":{"building":"commercial"},
"Education":{"building":"school"},
"Government":{"building":"government"},
"Industrial":{"building":"industrial"},
"Med":{"building":"hospital"},
"Mixed Use":null,
"OTH":null,
"Other":null,
"OTHER":null,
"Residential":{"building":"residential"},
"RESIDENTIAL":{"building":"residential"},
"Unknown":null,
"Vacant":null}
var layer = josm.layers.activeLayer; // Set to the active layer.
......@@ -28,18 +31,17 @@
counter = 0;
ds.each(function(obj){
if(obj.get("building")=="yes"){ // Don't override building tag if already set.
// If building type wasn't set by building data or by hand in merge, use address "PtType" tag
// TODO Improve to use map up above.
if(obj.get("PtType")=="Residential") obj.set("building","house"); // Assume house.
else if(obj.get("PtType")=="Commercial") obj.set("building","commercial"); // Assume commercial.
else if(obj.get("PtType")=="Industrial") obj.set("building","industrial"); // Assume industrial.
// Finally, use "APT" tag set in the addresses script if duplicates were found.
else if(obj.get("UnitType")=="APT") obj.set("building","apartments");
if(obj.get("building")!="yes") counter = counter + 1; // Increment counter if it changed.
// Don't override building tag if already set.
// If building type wasn't set by building data or by hand in merge, use "PtType" tag
if(obj.get("building")=="yes" && obj.has("PtType")){
var tags = ptTypeMap[obj.get("PtType")]; // Find the ptType entry
if(tags != null) {
Object.keys(tags).forEach(function(key){ // Set each tag defined in the ptType result.
console.println("{"+key+":"+tags[key]+"}");
obj.set(key, tags[key]);
});
counter = counter + 1;
}
}
// Assign utahagrc:parcelid if it's not set and can be. This should only occur on address points without buildings.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment