DEV Community

Алексей Спинов
Алексей Спинов

Posted on

How to Scrape Maps and Location Data (Google, OpenStreetMap, Mapbox)

Location data powers logistics, real estate, and local business tools.

OpenStreetMap (Free, Open)

Overpass API — completely free, no key:

async function searchOSM(query, bbox) {
  const overpass = `https://overpass-api.de/api/interpreter?data=[out:json];node["name"~"${query}"](${bbox});out;`;
  const res = await fetch(overpass);
  return res.json();
}
Enter fullscreen mode Exit fullscreen mode

Nominatim (Geocoding, Free)

https://nominatim.openstreetmap.org/search?q=coffee+shop+new+york&format=json
Enter fullscreen mode Exit fullscreen mode

Google Maps Places API ($200/mo credit)

async function nearbySearch(lat, lng, type, apiKey) {
  const url = `https://maps.googleapis.com/maps/api/place/nearbysearch/json?location=${lat},${lng}&radius=1000&type=${type}&key=${apiKey}`;
  return fetch(url).then(r => r.json());
}
Enter fullscreen mode Exit fullscreen mode

Mapbox (Free Tier)

https://api.mapbox.com/geocoding/v5/mapbox.places/coffee.json?access_token=TOKEN
Enter fullscreen mode Exit fullscreen mode

Data Available

  • Business name and address
  • Coordinates (lat/lng)
  • Category and type
  • Opening hours
  • Ratings and reviews

Resources


Need location or maps data? $20-50. Email: Spinov001@gmail.com | Hire me

Top comments (0)