GeoJSON uses [lng, lat] order. Coincidentally this worked for
/maps/embed links because the extraction was inverted too.
This fixes maps.google links POIs being shown in the wrong location.
---
main.go | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/main.go b/main.go
index 3666174..8f6e1e2 100644
--- a/main.go
+++ b/main.go
@@ -111,9 +111,9 @@ func fetchMember(pageURL string) (*geojsonFeature, error) {
if len(l) <= 6 {
return nil, fmt.Errorf("invalid map URL <%v>: missing lat/lng fields", mapRawURL)
}
- rawLat := l[5]
- rawLng := l[6]
- if !strings.HasPrefix(rawLat, "2d") || !strings.HasPrefix(rawLng, "3d") {
+ rawLat := l[6]
+ rawLng := l[5]
+ if !strings.HasPrefix(rawLat, "3d") || !strings.HasPrefix(rawLng, "2d") {
return nil, fmt.Errorf("invalid map URL <%v>: unsupported Google Maps link", mapRawURL)
}
@@ -158,7 +158,7 @@ func fetchMember(pageURL string) (*geojsonFeature, error) {
},
Geometry: geojsonPoint{
Type: "Point",
- Coordinates: [2]float64{lat, lng},
+ Coordinates: [2]float64{lng, lat},
},
}, nil
}
base-commit: bef9a0be18ba1ed00fc72da95116a982643dd895
--
2.30.0