We’ve released a few updates to Positionly today. Among minor changes and fixes, the most notable difference is the option to include Google Maps results in the positions count.
This comes in handy to everyone who would like to track positions localized to a specific city.
The feature can be activated from the Edit website and Engines page.
While looking for the perfect job as a Web developer some time ago, I began searching the internet to find a comprehensive listing of all web agencies located in Paris. I wanted to assess each one of them, and I scoured the internet in search of a thorough and complete list that I hadn’t found.
So, I could see the only option was to build the website myself. I was pondering where these agencies could be found and easily accessed online without being lost among the five or more million results from the Google search.
Google Places is a good method to locate businesses using the keywords of any region.
I discovered that virtually every agency on the internet was listed as a location to be found on Google Maps. What’s more, Google Maps API, specifically Google Places API, lets you accomplish all kinds of fantastic things, such as finding places using keywords and getting the location’s name as well as its website URL, pictures, and reviews.
If I could discover an approach to get as many results as I can for the Paris region using Google Places, a great part of the job could be done automatically, and it would also save me a considerable quantity of time.
Spoiler: I was able to find as many as 186 results from the Paris region that I am aware of, as it isn’t the complete number of web-based companies (some of them aren’t listed on Google Places, and some do not appear in the search results due to unknown reasons) however, it did allow me to uncover interesting results that I would not have seen in any other way. Here’s what it appears to be :
Map:
A listing (abridged):
Google Places API appeared to contain everything I needed to fulfill my requirements. Once you have done a search and the results returned, it is possible to retrieve the place details request permits you to retrieve the name, web address along with photos, and the rating of each location. I would like to know the size of every agency in terms of a number of employees, but, hey.
Searching for information
I created a project on localhost (I might need to utilize PHP later to save the results into an.txt file) and used all of the JavaScript API instructions to start this map (get this information from here) and then make the Radar Search request (get it here) :
The Text Search or a Nearby Search request allows you to access the parameters of the response you require, but with a major limitation that they can yield only 20 results per search. Each search can yield up to 60 effects that are split over three pages. This allows you to make use of the Next_Page_Token data to get a total of sixty results. However, you’re stuck.
The 60-result limit is just around the limit for queries
It is possible to use the Radar Search request, which allows you to search for as many as 200 locations at once; however, it returns less information than what is normally provided in a Text Search or Nearby Search request. It basically gives you an ID for each of the places, but you don’t get any more information about it, and not even an address.
This means that you’ll be required to go through the results before you can call the place details request by providing the ID for each of the locations you’ve discovered. This Place Details request is where all the parameters that we look for are retrieved.
This will happen during the callback to this service.radarSearch
function:
This is working… in part. It is true that I only get ten specific results when I loop through the results, even though the total number of results is 186. What’s the problem?
To get close to the 10 seconds of queries : setTimeout
and closures
The problem with this Place Details request is that it can provide the results of only ten at a time. The process is much less than one second, and it appears that we’ve hit a barrier here.
What happens if we use this setTimeout
function to get one result every second and never reach the limit of 10 results per second?
The setTimeout part that is used in the for loop is an example that has been documented well. Unpredictable behavior within JavaScript.
This is the point where closure is going to be of tremendous assistance by permitting us to save every value that we have found in our 186 results and then storing each one within the agencies
array for future use.