~emersion/public-inbox

This thread contains a patchset. You're looking at the original emails, but you may wish to use the patch review UI. Review patch

[PATCH avpn-extract] Fix coordinates order for maps.google links

Details
Message ID
<20220523172853.2389-1-delthas@dille.cc>
DKIM signature
pass
Download raw message
Patch: +3 -3
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
Reply to thread Export thread (mbox)