How to Extract Google Maps Data?

Divy Shah
4 min readNov 17, 2019
Coordinates of Google Map

In this article, I will show you how to extract Google Maps data or coordinate within some minutes.

Let’s go and learn the complete process to extract coordinates!!

As we see that the coordinates we are looking for it is actually hidden inside the URL. So we have to just use Regular expression (RE) to find out the exact matching for what we want.

Let’s understand it with an example.

Here I take an example of Tata Consultancy Services Olympus you can use any.

So, Let’s start to open Google Maps and enter the desired location to extract data.

Tata Consultancy Services Olympus

After this, you can easily see that coordinates of your searched location are available just after @ symbol.

Numbers in the box showing Coordinates

Now, we can start to extract the content or data from the URL. Generally, there are lots of tools available for doing this task in this example I used Octoparse Tool. You can use whatever tool that you like generally find out some open source tools for that because generally, these tools are very costly. Octoparse is a good web scraping tool, especially for extract google maps data. It would be good if you already have this on your computer or laptop.

Now input to the URL into the box:

“ https://www.google.com/maps/place/Tata+Consultancy+Services+Olympus/@19.2588504,72.9869883,17z/data=!3m1!4b1!4m5!3m4!1s0x3be7bb8b13413afd:0xdd6f5bb6d39673af!8m2!3d19.2588504!4d72.989177

"

Now we can start the extraction process.

click → browser.

Click → name.

The Action Tips panel gives you some options.

Click → Extract the text of selected element

Now you observed that the extraction has been successfully started and added to the workflow below. We can edit the field name any time from the setting area on the upper right area by entering the desired name.

Workflow

Now move toward the extraction field and click →“Add predefined field

Click → “Add current page information

Click → “Web page URL.”

advance editing

The Step for this is given below.

Click →“Customize” icon

Select →“Refine extract data”

Click → “Add Step”

This gives you a list of functions where you can select an option for data cleaning and various other options also.

In this case, we select “Match with RE (“Regular Expression”).

This gives you options to edit the data as the way you want by writing RE.

A “regular expression” is a special is a string that helps us to find out the desired pattern from the strings. It is not easy to create regular expression” it is difficult for some peoples. For that octoparse provide a built-in RegEx tool to help us.

for use that tool click →”RegEx Tool”

Notice that we want to pull the part after the “@” sign but before the second comma. Check the “Start With” box, and input “@”. This is telling the RegEx that you want the part after the sign. Identically, check “End With” box, and input “, 1”. As there are two commas behind the “@”, we’d better define which comma we want. Just simply add the number behind the comma, in this case, add number “1” This tells the RegEx that you want the part before the comma and number 1. Click the “Generate” button, the regular expression should be able to show in the box.

Now just confirm if we set properly by clicking the “Match” button. It generates the corresponding expression on the right. Boom! This is exactly what we want. Now go ahead and click “Apply” then Click “Ok” to confirm.

Yuppie the process is done you did it Let’s run the crawler by clicking on the run button and see it works or not.

The flow for this is given below

Click →“Start Extraction” click→“Local Extraction”.

here we go !! you can see the output as given below.

Extracted Data

Reference

https://www.google.com/maps/place/Tata+Consultancy+Services+Olympus/@19.2588504,72.9869883,17z/data=!3m1!4b1!4m5!3m4!1s0x3be7bb8b13413afd:0xdd6f5bb6d39673af!8m2!3d19.2588504!4d72.989177

suggestions or any improvement is accepted contact me on Divy Shah.

--

--