Skip to content

Instantly share code, notes, and snippets.

@cyfrost
Last active February 2, 2020 04:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cyfrost/261f1edbc4cb8021369980ab68144663 to your computer and use it in GitHub Desktop.
Save cyfrost/261f1edbc4cb8021369980ab68144663 to your computer and use it in GitHub Desktop.
convert OSM maps URL to Google Maps URL
#!/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
@cyfrost
Copy link
Author

cyfrost commented Feb 2, 2020

Usage: ./convert-osm-maps-url.sh "https://www.openstreetmap.org/?mlat=35.462558&mlon=-99.122877"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment