Fix country detection, fix phone number formatting, close #103
This commit is contained in:
parent
48ca24261f
commit
cba72ea915
3 changed files with 14 additions and 9 deletions
|
@ -110,14 +110,17 @@ export class FilteredLayer {
|
|||
|
||||
if (this.filters.matches(tags)) {
|
||||
const centerPoint = GeoOperations.centerpoint(feature);
|
||||
feature.properties["_surface"] = ""+GeoOperations.surfaceAreaInSqMeters(feature);
|
||||
const lat = ""+centerPoint.geometry.coordinates[1];
|
||||
const lon = ""+centerPoint.geometry.coordinates[0]
|
||||
feature.properties["_lon"] = lat;
|
||||
feature.properties["_lat"] = lon;
|
||||
feature.properties["_surface"] = "" + GeoOperations.surfaceAreaInSqMeters(feature);
|
||||
const lat = centerPoint.geometry.coordinates[1];
|
||||
const lon = centerPoint.geometry.coordinates[0]
|
||||
feature.properties["_lon"] = "" + lat; // We expect a string here for lat/lon
|
||||
feature.properties["_lat"] = "" + lon;
|
||||
// But the codegrid SHOULD be a number!
|
||||
FilteredLayer.grid.getCode(lat, lon, (error, code) => {
|
||||
if (error === null) {
|
||||
feature.properties["_country"] = code;
|
||||
} else {
|
||||
console.warn("Could not determine country for", feature.properties.id, error);
|
||||
}
|
||||
})
|
||||
|
||||
|
|
|
@ -87,10 +87,12 @@ export default class ValidatedTextField {
|
|||
"phone",
|
||||
"A phone number",
|
||||
(str, country: any) => {
|
||||
if (str === undefined) {
|
||||
return false;
|
||||
}
|
||||
return parsePhoneNumberFromString(str, country?.toUpperCase())?.isValid() ?? false
|
||||
},
|
||||
(str, country: any) => {
|
||||
console.log("reformatting phone nuber",str, "for locale", country)
|
||||
return parsePhoneNumberFromString(str, country?.toUpperCase()).formatInternational()
|
||||
}
|
||||
)
|
||||
|
|
|
@ -4,10 +4,10 @@
|
|||
"repository": "https://github.com/pietervdvn/MapComplete",
|
||||
"description": "A small website to edit OSM easily",
|
||||
"main": "index.js",
|
||||
"disabled:staticFiles": {
|
||||
"staticFiles": {
|
||||
"staticPath": [
|
||||
{
|
||||
"staticPath": "static-assets/tiles",
|
||||
"staticPath": "tiles/",
|
||||
"staticOutDir": "./tiles/"
|
||||
}
|
||||
]
|
||||
|
|
Loading…
Reference in a new issue