Articles » Google Maps » The Ultimate Guide to Extracting Data from Google Maps with JavaScript API in 2026

Video: The Ultimate Guide to Extracting Data from Google Maps with JavaScript API

Table of Contents

  1. Why Extract Data from Google Maps in 2026?
  2. Setting Up Your Google Maps API Key (2026 Updated Process)
  3. Example 1 — Geocoding Addresses with the Geocoding API
  4. Example 2 — Extracting Business Data with Google Places API
  5. Example 3 — Calculating Routes with the Directions API
  6. Google Maps API Limitations: Where the Official API Falls Short
  7. The No-Code Alternative: Scrap.io for Google Maps Data Extraction
  8. Legal Considerations and Best Practices in 2026
  9. Frequently Asked Questions
  10. Conclusion — Choose the Right Method for Your Scale

Why Extract Data from Google Maps in 2026?

The Scale of Google Maps Data

Most people open Google Maps to find a coffee shop. Developers open it for something else entirely — a self-updating dataset of nearly every business on the planet.

The numbers are absurd. 2 billion monthly active users. 250+ million business listings across 250+ countries. And here's the kicker: 1.5 million new listings every single day. Phone numbers, hours, photos, reviews, websites — published by the businesses themselves and pressure-tested by strangers leaving reviews on a Tuesday afternoon.

If you're doing lead gen, market research, or competitive intel, this is arguably the most valuable public dataset that exists. Validated. Free to read. Refreshed continuously.

So the question isn't whether you should extract it. The question is how — and what it'll cost you.

Real Business Use Cases for Maps Data Extraction

A few things people actually do with this data:

  • Lead generation. Pull every plumber within 20 miles of Dallas, ratings included, phones attached. Hand the file to a sales rep on Monday morning.
  • Market research. Manhattan has 400+ pizza places. Akron, Ohio has 14. That's not trivia — that's a market opportunity hiding inside a heatmap.
  • Location scouting. Pick the spot for your new franchise based on competitor density and complementary businesses nearby.
  • Sales outreach. Take a list of B2B prospects and enrich it with verified phones, websites, and review snippets. (Our complete Google Maps API guide walks through more examples.)
  • Route optimization. Calculate delivery times against real-time traffic. Save the dispatcher a few headaches.

(If you want the wider angle before getting into code, our complete guide to Google Maps scraping covers the whole landscape.)

Setting Up Your Google Maps API Key (2026 Updated Process)

Creating a Google Cloud Project

Head to the Google Cloud Console.

  1. Click Create Project (top left).
  2. Name it whatever. "Maps Data Extraction" works fine. Nobody's grading you.
  3. Click Create. Wait about 30 seconds.
  4. Project should appear selected in your dropdown.

Now turn on billing — and yes, this is mandatory, even for free-tier usage. Google won't let you touch any API without a card on file. (We wrote a full walkthrough on how to get your Google Maps API key if you want it step-by-step.)

  1. Billing → left sidebar.
  2. Link a billing account. Create one if you don't have it.
  3. Attach the billing account to the project.

Card linked. You won't get charged unless you blow past the free quotas, but the card has to be valid. (Yes, this changed with the March 2025 update. We'll get to that.)

Enabling the Right APIs

Google sells access per API, not as a bundle. So you enable each one separately.

  1. APIs & ServicesLibrary.
  2. Enable these:
    • Google Maps JavaScript API (for loading maps in browsers)
    • Geocoding API (addresses ↔ coordinates)
    • Places API (businesses and details)
    • Directions API (routes and traffic)

Hit Enable on each. Wait for the green checkmark.

API Key Configuration & Security Best Practices

  1. APIs & ServicesCredentials.
  2. + Create CredentialsAPI Key.
  3. Copy the key. Don't paste it anywhere public.

Now restrict it. This part is non-negotiable:

  1. Click the API key you just made.
  2. Application restrictionsHTTP referrers (web sites).
  3. Add your domain (e.g., example.com/*). Stops someone from grabbing your key and racking up charges on their own site.
  4. API restrictionsRestrict key → check only the APIs you'll use.

Save.

One real security note: never push your key to a public GitHub repo. People scan those repos for API keys every minute of every day. Use environment variables.

// DON'T DO THIS in production
const apiKey = "AIzaSy..."; // visible to anyone

// DO THIS instead
const apiKey = process.env.GOOGLE_MAPS_API_KEY;

Google Maps API Pricing in 2026: What You'll Actually Pay

Google overhauled pricing in March 2025. The old $200 monthly credit? Gone. RIP.

The new model: free quotas per SKU, then pay-as-you-go.

API Essentials (Free) Pro (Paid)
Geocoding 10,000 free/month $5 per 1,000
Place Details 5,000 free/month $17 per 1,000
Directions 10,000 free/month $10 per 1,000
Nearby Search 10,000 free/month $7 per 1,000

Real cost example. You want 50,000 business profiles (search + details):

  • 50K Nearby Searches × $7/1K = $350
  • 50K Place Details × $17/1K = $850
  • Total: ~$1,200 — just for extraction, ignoring Geocoding

That's not nothing. And it scales linearly with volume — no bulk discount for the little guys. (We built a Google Maps API pricing calculator if you want to model your specific numbers.)

extract data from google maps with Scrap.io search

Looking for a more cost-effective path? Platforms like Scrap.io let you extract Google Maps business data — emails included — with a free trial and 100 free leads to test. Try Scrap.io free →

Example 1 — Geocoding Addresses with the Geocoding API

How Geocoding Works (Code Walkthrough)

Geocoding is the simplest piece of the puzzle. Address in, coordinates out. Or the other way around — reverse geocoding.

Example: "1600 Amphitheatre Parkway, Mountain View, CA" → {lat: 37.4224, lng: -122.0842}.

The code:

// Load the API in your HTML
<script src="https://maps.googleapis.com/maps/api/js?key=YOUR_API_KEY"></script>

// Geocode an address to coordinates
const geocoder = new google.maps.Geocoder();

const address = "1600 Amphitheatre Parkway, Mountain View, CA";

geocoder.geocode({ address: address }, (results, status) => {
  if (status === "OK") {
    const location = results[0].geometry.location;
    console.log(`Latitude: ${location.lat()}, Longitude: ${location.lng()}`);
    // Output: Latitude: 37.4224, Longitude: -122.0842
  } else {
    console.error(`Geocoding failed: ${status}`);
  }
});

// Reverse geocode: coordinates to address
const coordinates = { lat: 37.4224, lng: -122.0842 };

geocoder.geocode({ location: coordinates }, (results, status) => {
  if (status === "OK") {
    const address = results[0].formatted_address;
    console.log(`Address: ${address}`);
    // Output: Address: 1600 Amphitheatre Parkway, Mountain View, CA 94043, USA
  } else {
    console.error(`Reverse geocoding failed: ${status}`);
  }
});

Two directions, one API. Clean.

Cost reality check. $5 per 1,000 requests once you burn through the free 10K/month. Geocoding 100,000 addresses? Roughly $500 in API spend (minus the free tier).

Handling Edge Cases & Batch Geocoding

Real addresses are messy. Missing ZIPs. Typos. Ambiguous names ("Main St" exists in something like 500 US cities, give or take).

The API returns a results array. The first match is usually right — but sometimes you want the alternatives:

geocoder.geocode({ address: "Main St" }, (results, status) => {
  if (status === "OK" && results.length > 0) {
    console.log(`Found ${results.length} matches:`);
    results.forEach((result, index) => {
      console.log(`${index + 1}. ${result.formatted_address}`);
    });
  }
});

Batch geocoding trips up beginners. Don't just loop and fire a request per address — you'll hit rate limits and get throttled. Or worse, blocked for the day.

Queue them. Add a delay:

const addresses = [
  "1600 Amphitheatre Parkway, Mountain View, CA",
  "1355 Market St, San Francisco, CA",
  // ... more addresses
];

async function batchGeocode(addresses, delayMs = 100) {
  const results = [];

  for (const address of addresses) {
    const result = await new Promise((resolve) => {
      geocoder.geocode({ address }, (results, status) => {
        if (status === "OK") {
          resolve({ address, lat: results[0].geometry.location.lat(), lng: results[0].geometry.location.lng() });
        } else {
          resolve({ address, error: status });
        }
      });
    });

    results.push(result);

    // Delay between requests to avoid rate limiting
    await new Promise(resolve => setTimeout(resolve, delayMs));
  }

  return results;
}

batchGeocode(addresses).then(results => {
  console.table(results);
});

The 100ms gap keeps Google happy. It also keeps your IP off the naughty list.

Example 2 — Extracting Business Data with Google Places API

Nearby Search: Finding Businesses by Category & Location

This is where it gets interesting. Places API is the one you actually want for lead generation.

// Initialize the Places service
const service = new google.maps.places.PlacesService(map);
// Note: PlacesService requires a map instance

// Search for restaurants within 5km of a location
const request = {
  location: { lat: 40.7128, lng: -74.0060 }, // NYC coordinates
  radius: 5000, // 5km in meters
  type: "restaurant",
};

service.nearbySearch(request, (results, status) => {
  if (status === google.maps.places.PlacesServiceStatus.OK) {
    console.log(`Found ${results.length} restaurants:`);
    results.forEach((place) => {
      console.log(`${place.name} - Rating: ${place.rating}`);
    });
  } else {
    console.error(`Search failed: ${status}`);
  }
});

Each result hands you back:

  • name: Business name
  • place_id: Unique identifier (cache this — Google lets you store it forever)
  • geometry.location: Coordinates
  • rating: 1-5 stars
  • types: Business categories
  • vicinity: Short address

Useful for inventory. Not enough for outreach. You need phones, websites, the full kit — and that takes a second call: getDetails().

Place Details: Pulling Phone, Website, Ratings & Reviews

// Get full details for a specific place
const request = {
  placeId: "ChIJIQBpAG2dQIcR_6128GltTXQ", // Google's place ID
  fields: [
    "name",
    "rating",
    "formatted_phone_number",
    "website",
    "url", // Google Maps URL
    "reviews",
    "opening_hours",
    "formatted_address",
    "business_status",
  ],
};

service.getDetails(request, (place, status) => {
  if (status === google.maps.places.PlacesServiceStatus.OK) {
    console.log(`Name: ${place.name}`);
    console.log(`Phone: ${place.formatted_phone_number}`);
    console.log(`Website: ${place.website}`);
    console.log(`Rating: ${place.rating} (${place.reviews?.length} reviews)`);

    if (place.reviews) {
      place.reviews.slice(0, 3).forEach((review) => {
        console.log(`Review: "${review.text}" - ${review.author_name}`);
      });
    }
  }
});

Cost: Place Details = $17 per 1,000. Pulling details for 10,000 businesses lands you at $170, on top of whatever Nearby Search just cost you.

Field Masks: Optimizing Costs by Requesting Only What You Need

A trick that'll save you real money: be deliberate about what you ask for.

The Places API doesn't charge per field — but premium fields (reviews especially) bill separately. So requesting reviews when all you needed was a phone number? That's just lighting cash on fire.

// Cheap request (basic info only)
const cheapRequest = {
  placeId: "ChIJ...",
  fields: ["name", "formatted_phone_number", "website", "rating"],
};
// Cost: ~$0.017 per request

// Expensive request (with reviews)
const expensiveRequest = {
  placeId: "ChIJ...",
  fields: ["name", "formatted_phone_number", "website", "rating", "reviews"],
};
// Cost: ~$0.034 per request (reviews are extra)

Audit your field requests every few weeks. Almost guaranteed you'll find ones you stopped using six months ago.

extract data from google maps filters on Scrap.io

Example 3 — Calculating Routes with the Directions API

Route Parameters (Mode, Departure Time, Waypoints)

Directions API is the one you'd use to build a delivery dispatcher, or estimate ETA for sales reps driving to appointments.

const directionsService = new google.maps.DirectionsService();

const request = {
  origin: "New York, NY",
  destination: "Los Angeles, CA",
  travelMode: google.maps.TravelMode.DRIVING,
  departureTime: new Date(Date.now() + 3600000), // 1 hour from now
  traffic_model: google.maps.TrafficModel.BEST_GUESS,
};

directionsService.route(request, (result, status) => {
  if (status === google.maps.DirectionsStatus.OK) {
    const route = result.routes[0];
    const leg = route.legs[0];

    console.log(`Distance: ${leg.distance.text}`);
    console.log(`Duration: ${leg.duration.text}`);
    console.log(`Duration in traffic: ${leg.duration_in_traffic.text}`);
  }
});

The parameters that actually matter:

  • travelMode: DRIVING, WALKING, BICYCLING, or TRANSIT. Most people only use the first.
  • departureTime: Include this and the API factors in real traffic. Skip it and you get a generic, traffic-free estimate.
  • waypoints: Stops in between. Array of objects. Example: [{location: "Chicago, IL"}, {location: "Kansas City, MO"}].

Parsing Distance & Duration from API Response

The response nests: routeslegsdistance / duration. Multiple waypoints means multiple legs. Parse each one separately:

directionsService.route(request, (result, status) => {
  if (status === google.maps.DirectionsStatus.OK) {
    const route = result.routes[0];

    route.legs.forEach((leg, index) => {
      console.log(`Leg ${index + 1}:`);
      console.log(`  Origin: ${leg.start_address}`);
      console.log(`  Destination: ${leg.end_address}`);
      console.log(`  Distance: ${leg.distance.value} meters (${leg.distance.text})`);
      console.log(`  Duration: ${leg.duration.value} seconds (${leg.duration.text})`);

      // If traffic data is available
      if (leg.duration_in_traffic) {
        const delaySeconds = leg.duration_in_traffic.value - leg.duration.value;
        console.log(`  Traffic delay: ${Math.round(delaySeconds / 60)} minutes`);
      }
    });
  }
});

Cost: Directions API = $10 per 1,000 requests. A logistics outfit running 100,000 route calculations a month is looking at $1,000/month just for routing. That's not catastrophic, but it adds up over a year.

Google Maps API Limitations: Where the Official API Falls Short

The official API is good. It's also expensive, capped, and missing the data most lead-gen people actually want.

Rate Limits, Quotas & Escalating Costs at Scale

Every API has quotas. Google's are not generous if you're serious about volume:

API Essentials (Free Tier) Daily Limit
Geocoding 10,000/month 10,000/month
Place Details 5,000/month 5,000/month
Nearby Search 10,000/month 10,000/month
Directions 10,000/month 10,000/month

A startup doing real lead generation — let's say 50K profiles a month — will torch these by mid-month. Then you're paying full freight. And it adds up faster than people expect.

The $34 Per 1,000 Problem: When API Costs Become Prohibitive

Napkin math time. A complete business profile = Nearby Search + Place Details.

  • Nearby Search: $7/1K
  • Place Details: $17/1K
  • Combined: $24/1K

10K businesses → $240. 50K → $1,200. 500K — a serious market research project — costs $12,000.

And here's the thing nobody mentions in the docs: business data rots. Phones change. Restaurants close. Reviews get added. You don't pay once — you re-extract quarterly, sometimes monthly. That $12K is suddenly recurring.

Data Gaps — What the API Doesn't Give You (Emails, Direct Phones)

The Places API hands you:

  • Name, address, phone, website, rating, reviews, hours

It does not hand you:

  • Direct owner/manager emails
  • Ownership structure
  • Employee count
  • Revenue or financial data
  • Secondary phone lines (just the main one)
  • Social profiles (sometimes appears, often doesn't)

If your goal is B2B outreach to a real decision-maker, the Places API gets you halfway there at best. The other half — finding the actual human to email — needs enrichment from somewhere else. (We dug into this in our guide on how to find email addresses from Google Maps.)

The No-Code Alternative: Scrap.io for Google Maps Data Extraction

If the official API feels like paying for the privilege of building your own scraper, there's another route.

How Scrap.io Bypasses API Limitations

Scrap.io is a no-code Google Maps extraction platform. Instead of hitting the official API at $7-$34 per 1,000 calls, you point and click:

  • Extract businesses by location, category, radius, or custom polygon
  • Pull phones, websites, ratings, reviews
  • Enrich with email addresses via integrated data providers
  • Export to CSV, Excel, or pipe directly into your CRM
  • Run thousands of queries without rate-limit anxiety

And the part that actually matters: dramatically cheaper at volume.

Extracting 100K businesses through the official API runs $2,400+. Scrap.io is a fraction of that.

GeoSearch: Extract Businesses by Radius or Custom Polygon

Scrap.io's GeoSearch is the feature that sells itself. You draw on a map. It extracts.

Two modes:

  1. Radius search. Drop a pin, set a distance, extract everything matching inside.
  2. Polygon search. Draw a custom boundary — a territory, a neighborhood, a zip code outline. Extract what's inside.

Example: every plumber inside a 2km circle around downtown Denver.

  1. Open Scrap.io → New Search.
  2. Pick GeoSearch.
  3. Location: "Downtown Denver, CO"
  4. Radius: 2km
  5. Search term: "plumber"
  6. Click Extract.

Minutes later you've got names, addresses, phones, ratings. No API juggling. No quota tracking. No spending an afternoon debugging why the loop crashed at request 8,432.

extract data from google maps GeoSearch radius

For real territory work, polygon is where it shines. Draw the actual boundary of your sales region. Pull what's inside.

extract data from google maps GeoSearch polygon

CSV/Excel Export with Email & Phone Enrichment

Export to CSV or Excel the moment extraction finishes. Then, optionally, enrich:

  • Phones. Verified numbers, useful when the Google listing is incomplete or out of date.
  • Emails. Owner or decision-maker emails — the stuff the official API will never give you.

The enrichment happens automatically. No manual website-hunting required.

This isn't theoretical, by the way. GroupBWT pulled millions of POIs across six countries — France, Italy, Spain, Germany, UK, Australia. NYC alone: 5,518 restaurants plus 760 hotels. Their trick? Slice cities into 2km grids, run hybrid keyword + full-map extraction, cross-validate with OpenStreetMap. A digital marketing consultancy using Outscraper extracted 120,000+ locations in 12 months — their team described the ROI as "breath-taking." Another team running an Apify workflow scaled outreach from 50 to 400 emails per week, freeing up 40+ hours of manual prospecting. Zero2Income / Dana spent two-plus years building a state-wide US business directory from Google Maps data. Even logistics is in on it — one firm cut average delivery times by 20% through route optimization built on Maps location data.

Different teams. Different goals. Same source of truth.

Want to skip the API setup and start extracting leads now? Try Scrap.io free and get 100 verified business contacts from Google Maps.

Google's Terms of Service & API Usage Rules

Using the official API within Google's terms is legal. Full stop. Google explicitly permits data extraction this way.

The rules you actually need to remember:

  1. Don't cache responses longer than 30 days. (place_id is the exception — that one you can keep forever.)
  2. Don't store API responses to build a competing database without a license agreement.
  3. Show proper attribution if you display Maps data publicly.
  4. No offline use without explicit permission.

In plain English: extract for your business purpose, use it for that purpose, don't republish it as your own product.

GDPR, CAN-SPAM & Data Compliance

Extracting data is one thing. Contacting the humans behind it is another.

GDPR (Europe). If your prospects are EU citizens, "I found you on Google Maps" doesn't cut it as a legal basis. You need one of:

  • Consent (they opted in)
  • Legitimate interest (with a clear privacy notice)
  • Existing customer relationship

CAN-SPAM (USA). Emailing extracted leads requires:

  • A valid physical address in the footer
  • Working unsubscribe, honored within 10 days
  • Honest subject lines (no "RE:" tricks pretending you've already had a conversation)

Bottom line: the extraction is fine. The outreach has to follow the rules of wherever your prospect lives.

API vs. Scraping: Which Is Legally Safer?

Official API: safe. You're inside Google's playground, following their rules.

Direct scraping (Selenium, Playwright, the DIY route): grayer. Courts have mostly held that accessing publicly available data is permissible (we wrote a full breakdown on whether it's legal to scrape Google Maps), but you should know:

  • Bypassing rate limits or ignoring robots.txt creates real legal risk
  • Google can — and will — block bot traffic when it spots a pattern
  • Some terms-of-service violations have triggered actual lawsuits

For enterprise or long-term projects, the API is the safer call even at the premium price.

For one-offs or smaller-scale work, platforms like Scrap.io handle the legal and technical complexity for you. And if you'd rather stay browser-based, here's our roundup of Google Maps scraper Chrome extensions.

Frequently Asked Questions

Q1: Is it possible to extract data from Google Maps?

Yes. Three main routes:

  1. Official Google Maps API (Geocoding, Places, Directions). Structured, legal, auditable. Costs $5-$34 per 1,000 requests depending on the endpoint.
  2. DIY scraping (Python, Selenium, Playwright). Cheaper upfront. Breaks every time Google updates their HTML. High maintenance.
  3. No-code platforms (Scrap.io, Outscraper). Done-for-you. Handles rate limits, enrichment, and compliance. Fixed pricing.

All three deliver names, addresses, ratings, reviews, phones, and websites. Only the last two reliably give you email addresses.

Q2: Is Google Maps JavaScript API free in 2026?

Sort of. Google killed the old $200 monthly credit in March 2025. The new model: free monthly quotas per SKU.

  • Geocoding: 10,000 free/month, then $5/1K
  • Place Details: 5,000 free/month, then $17/1K
  • Directions: 10,000 free/month, then $10/1K

You also need a valid billing account on file — even when staying under the free tier. So technically free. Practically paid the moment you do real work.

Q3: Is it legal to scrape data from Google Maps?

Via the official API: completely legal.

Direct scraping: generally legal if you stick to publicly available data, but courts look at things like:

  • Did you ignore robots.txt or violate rate limits?
  • Did you bypass technical protections?
  • Are you complying with GDPR / CCPA / CAN-SPAM where you operate?

And remember: extracting data is one question, using it is another. CAN-SPAM and GDPR govern the outreach side regardless of how you got the list.

Q4: What is the limit of scraping Google Maps?

Official API: quotas vary by tier. Essentials: 5K-10K per month. Pro: higher daily limits. Enterprise: custom contracts.

Direct scraping: no hard limit on paper, but Google caps search results at around 120 per query and aggressively blocks bot patterns.

No-code platforms (Scrap.io): up to 5,000+ queries per minute, with no practical cap for normal users.

Q5: How much does the Google Maps API cost in 2026?

Pay-as-you-go pricing:

  • Geocoding API: ~$5 per 1,000 requests
  • Place Details API: ~$17 per 1,000 base, ~$34/1K with reviews
  • Directions API: ~$10 per 1,000 requests
  • Nearby Search: ~$7 per 1,000 requests

Subscription plans for higher volumes:

  • Starter: $100/mo → 50,000 calls
  • Essentials: $275/mo → 100,000 calls
  • Pro: $1,200/mo → 250,000 calls
  • Enterprise: custom pricing

For anything beyond hobby-scale, you'll need a subscription. Pay-as-you-go is only economical at tiny volumes.

Conclusion — Choose the Right Method for Your Scale

Three paths to extract data from Google Maps. Pick the one that matches your scale, your budget, and your tolerance for technical maintenance.

Use the official API if:

  • You're building production software
  • You need legal compliance auditability
  • Your volume justifies $500-$10K monthly in API spend
  • You have engineering resources to manage quotas and keys

Use DIY scraping if:

  • You're comfortable in Python or JavaScript
  • It's a one-time extraction, not an ongoing pipeline
  • You can absorb maintenance pain when Google changes their HTML
  • You're okay accepting some legal gray and getting blocked occasionally

Use a no-code platform if:

  • You want data this week, not next quarter
  • You need email enrichment, not just business listings
  • Your budget is under $500/month
  • You'd rather pay per data point than babysit an API integration

For most lead generation, market research, and location intelligence work? A platform like Scrap.io is the right answer. No API key juggling. No surprise $2,400 invoices. No rate-limit stress at 2 a.m.

And the one thing the official API will never give you: emails. That's the gap between a list of businesses and a list of actual prospects you can contact.

Ready to extract Google Maps data at scale? Start your free trial on Scrap.io — get 100 verified leads instantly, no API key required.

Ready to generate leads from Google Maps?

Try Scrap.io for free for 7 days.