osm-coverage icon indicating copy to clipboard operation
osm-coverage copied to clipboard

Handle country/regions with same names

Open planemad opened this issue 9 years ago • 1 comments
trafficstars

While processing region coverage, noticed that the code does not handle duplicate names and the numbers are overwritten over a state with the same name of a different country, eg. Punjab in Pakistan and India.

planemad avatar Nov 27 '15 12:11 planemad

@planemad I think you would want to include country + region name in the results. So for example, on the region branch, you'd need to do:

var country = findCountry(tile, countryIndex);
var state = findState(tile, stateIndex);

var resultClasses = {};
resultClasses[country] = {};
resultClasses[country][state] = {
  "classified": {},
  "raw": {}
};

// ....

handleRoad(ft.toGeoJSON(tile[0], tile[1], tile[2]), bbox, resultClasses[country][state]);

This will nest the state/regions under the countries, preventing collision.

tcql avatar Dec 17 '15 19:12 tcql