Public
Like
GoogleMapsToOSM
Val Town is a collaborative website to build and scale JavaScript apps.
Deploy APIs, crons, & store data – all from the browser, and deployed in milliseconds.
index.ts
https://bart--fb5012eac4b911f0a33b42dde27851f2.web.val.run
A Val Town service that converts Google Maps links to OpenStreetMap.org links. This tool extracts location information from various Google Maps URL formats and generates the corresponding OpenStreetMap URLs.
- Web Interface: User-friendly form for easy conversion
- API Endpoints: Both GET and POST endpoints for programmatic access
- Multiple URL Formats: Supports various Google Maps URL patterns
- Error Handling: Provides clear error messages for invalid inputs
- Copy to Clipboard: Easy copying of converted URLs
- Shortened URLs:
maps.app.goo.gl/...,goo.gl/...,g.co/... - Direct coordinate links:
maps.google.com/@lat,lng,zoom - Place searches:
maps.google.com/place/Location+Name/@lat,lng,zoom - Search queries:
maps.google.com/?q=search+term - Links with
ll=orcenter=parameters - Street view and other coordinate-based URLs
Visit the val URL directly in your browser to access the web interface. Simply paste a Google Maps URL and click "Convert to OpenStreetMap" to get the corresponding OSM link.
GET /?url=<encoded_google_maps_url>
Example:
GET /?url=https%3A//www.google.com/maps/%4040.7128%2C-74.0060%2C15z
POST /
Content-Type: application/json
{
"url": "https://www.google.com/maps/@40.7128,-74.0060,15z"
}
Success Response:
{ "original": "https://www.google.com/maps/@40.7128,-74.0060,15z", "converted": "https://www.openstreetmap.org/#map=15/40.7128/-74.006", "success": true }
Error Response:
{ "error": "Not a valid Google Maps URL", "success": false }
- Input:
https://maps.app.goo.gl/KX1cGxZiY2jK9NFZ8 - Output:
https://www.openstreetmap.org/#map=14/51.7532108/6.38258
- Input:
https://www.google.com/maps/@40.7128,-74.0060,15z - Output:
https://www.openstreetmap.org/#map=15/40.7128/-74.006
- Input:
https://www.google.com/maps/place/Statue+of+Liberty/@40.6892,-74.0445,17z - Output:
https://www.openstreetmap.org/#map=17/40.6892/-74.0445
- Input:
https://www.google.com/maps?q=Central+Park+New+York - Output:
https://www.openstreetmap.org/search?query=Central%20Park%20New%20York
The converter uses pattern matching to extract:
- URL Expansion: Automatically follows redirects for shortened URLs (goo.gl, maps.app.goo.gl, g.co)
- Coordinates: Latitude, longitude, and zoom level from various URL patterns
- Place Names: Location names for search-based conversions
- Zoom Levels: Maintains appropriate zoom levels for map viewing
When coordinates are available, it generates direct map links. When only place names are found, it creates search URLs on OpenStreetMap.
The service handles various error cases:
- Invalid URLs
- Non-Google Maps URLs
- URLs without extractable location information
- Malformed requests
All errors return appropriate HTTP status codes and descriptive error messages.