~emersion/public-inbox

avpn-extract: Fix coordinates order for maps.google links v1 SUPERSEDED

delthas: 1
 Fix coordinates order for maps.google links

 1 files changed, 3 insertions(+), 3 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/32474/mbox | git am -3
Learn more about email & git

[PATCH avpn-extract] 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 | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/main.go b/main.go
index 3666174..baff113 100644
--- a/main.go
+++ b/main.go
@@ -111,8 +111,8 @@ 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]
		rawLat := l[6]
		rawLng := l[5]
		if !strings.HasPrefix(rawLat, "2d") || !strings.HasPrefix(rawLng, "3d") {
			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