~emersion/public-inbox

avpn-extract: Fix coordinates order for maps.google links v2 APPLIED

delthas: 1
 Fix coordinates order for maps.google links

 1 files changed, 4 insertions(+), 4 deletions(-)
Export patchset (mbox)
How do I use this?

Copy & paste the following snippet into your terminal to import this patchset into git:

curl -s https://lists.sr.ht/~emersion/public-inbox/patches/32475/mbox | git am -3
Learn more about email & git

[PATCH avpn-extract v2] Fix coordinates order for maps.google links Export this patch

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
Pushed, thanks!