Skip to content

Commit 4d37b8c

Browse files
committed
filter out extra features
1 parent 362233a commit 4d37b8c

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

src/lib/geo_location_utils.js

+13-1
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ function locationToFeature(locationmode, location, features) {
6262

6363
for(i = 0; i < filteredFeatures.length; i++) {
6464
f = filteredFeatures[i];
65-
if(f.id === locationId) return f;
65+
if(f.id === locationId && isMainCountryFeature(f)) return f;
6666
}
6767

6868
loggers.log([
@@ -74,6 +74,18 @@ function locationToFeature(locationmode, location, features) {
7474
return false;
7575
}
7676

77+
function isMainCountryFeature(feature) {
78+
// Returns false for certain features which are not the main region of their country
79+
if(feature.id === 'USA') {
80+
if(feature.properties && feature.properties.ct && feature.properties.ct[0] == -155.5 &&
81+
feature.properties.ct[1] == 19.6) {
82+
// Hawaii
83+
return false;
84+
}
85+
}
86+
return true;
87+
}
88+
7789
function feature2polygons(feature) {
7890
var geometry = feature.geometry;
7991
var coords = geometry.coordinates;

0 commit comments

Comments
 (0)