Last active
February 2, 2020 04:41
-
-
Save cyfrost/261f1edbc4cb8021369980ab68144663 to your computer and use it in GitHub Desktop.
convert OSM maps URL to Google Maps URL
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# Script example usage: ./convert-osm-maps-url.sh "https://www.openstreetmap.org/?mlat=35.462558&mlon=-99.122877" | |
osm_url="$1" | |
lat=$(echo "$osm_url" | sed -E 's/.*mlat=([^&]+).*/\1/') | |
lon=$(echo "$osm_url" | sed -E 's/.*mlon=([^&]+).*/\1/') | |
gmaps_link="https://www.google.com/maps/?q=$lat,$lon" | |
echo $gmaps_link |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Usage:
./convert-osm-maps-url.sh "https://www.openstreetmap.org/?mlat=35.462558&mlon=-99.122877"