There are a lot of services that google provides, one of which is the Google Maps platform. However, there is pricing associated with Google Maps services. In addition, pricing information is found elaborated in this link.
This article relates to several implementations that were discovered and could be beneficial to readers.
Let’s now examine how we might lower the price without compromising our achievements.
How does Google cost us?
Google cost us with the usage based on SKU (Stock Keeping Units). The cost of each service is based on how often the services are used. The prices are different for each service.
To clarify, There are three price tiers
- 0 to 100,000 requests per month,
- 100,001 to 500,000 requests per month.
- over 500,000 requests per month.
However, Billing can be per request or session based, we should be selecting them based on our requirements. Let us dig deep into this.
Let’s include Google Maps on our website…
STEP 1: Create a new Google Maps Key from the Google cloud console.
STEP 2: Include the Google Maps script as below. (Note: Place the key generated from the console in the place of “YOUR_API_KEY”)
There are two implementations we can go with.
Implementation with Scripts, Inline Loading!
Implementation with Package, Dynamic Loading.
Our website will include a map likewise…
YAAYYY!!!! As simple as that we have introduced Google maps to our website.
Specifications on Payload!
There are different packages of Data Fields that Google provides us.
- Basic Data Field
- Contact Data Field
- Atmosphere Data Field
Requests should have a data field in them for accomplishing this.
When there is a request of
vicinity. Then, Basic Data will be fetched. In fact, there will be no additional charge.
So the efficient way to implement is to mention the Data fields that are require.
We may also think about moving forward with session-based implementation to further lower the charge per request.
Let’s reduce the cost of Places Autocomplete…
Google Maps Places Autocomplete Widget:
when the user searches for a place, there is a drop-down shown to the user. Firstly, the users select the places in the drop-down. Here, we might need to request Geocoder API. In this scenario, the Places Autocomplete widget is the best option. Places Autocomplete widget provides us with all the data for the place predictions and data on lat, and long. This reduces an additional Geocoder requests particularly.
The request should be make only for the fields requires keeping in mind to reduce the cost.
Limitations. It could be challenging to implement the customization under the Places Autocomplete widget.
The places autocomplete widget will not be requires to explicitly handle the session token. The session is maintaines internally here.
Let’s look deep into the Places Autocomplete Service…
Google Maps Places Autocomplete Service:
Google Autocomplete Service is use to help our users to complete searches when they start to type. That is to say, We will be sending the request for data most frequently for this.On the other hand, if the billing is for every request make, then the implementation is not efficient. In this scenario, Session Tokens come to the developer’s aid.
Implementation with session tokens will reduce the cost per request.
For example, There is our website where the user is searching for a city – Los Angeles. Let’s say the api (autocomplete per request) will be calles thrice here. Meanwhile, costs are involves for all the api calls.But, if we go with Session-based implementation, then there will be a single charge for the entire session
Google Maps Embed API
Maps Embed API also provides Street View Services for ZERO cost at unlimited usage.
Limitations of Embed API – When there is no Street View available, the Iframe will have a blank black page displayed.
Dynamic Street View Service costs 14 USD per 1000 requests
Static Street View Service costs 7 USD per 1000 requests
Street View Embed costs ZERO for unlimited requests
To sum up, there are numerous possibilities for one implementation to choose from among the various SKUs and Services that Google offers. Most certainly, We as a developer have to ensure the best path to take based on the requirements.
Happy Coding!! Please mention any interesting Google Maps features in the comments.
Get to know about Rently at https://use.rently.com/
To learn more about Engineering topics visit – https://engineering.rently.com
Senior Software Engineer,
Rently Software Development Private Limited,