The Geocoding API v4 introduces several new methods that replace functionality in v3 of the API. This guide shows you how to migrate your app to use the new v4 methods.
You can use your existing API keys with the new v4 methods. However, if you have requested a quota uplift on v3 of the API, you must request an uplift on the new v4 APIs.
v3 ফরওয়ার্ড জিওকোডিং থেকে মাইগ্রেট করুন
If you use v3 Geocoding to geocode addresses, you should migrate to the v4 Geocode an address method, which accepts a GET request.
The v4 API changes names, structure, and support for several parameters. We strongly recommend that you use a field mask to specify the fields you want returned in the response.
অনুরোধ প্যারামিটার পরিবর্তন
| v3 প্যারামিটার | v4 প্যারামিটার | নোট |
|---|---|---|
address , components | address | Unstructured address (v3 address ) is now passed in URL path. Component filters (v3 components ) are now passed as address.* query parameters. |
bounds | locationBias.rectangle | নাম পরিবর্তন করা হয়েছে; কাঠামো পরিবর্তন করে অবজেক্ট করা হয়েছে। |
language | languageCode | নাম পরিবর্তন করা হয়েছে। |
region | regionCode | নাম পরিবর্তন করা হয়েছে। |
extra_computations | অপসারণ করা হয়েছে |
প্রতিক্রিয়া ক্ষেত্রের পরিবর্তন
| v3 ফিল্ড | ভি৪ ফিল্ড | নোট |
|---|---|---|
status , error_message | অপসারণ করা হয়েছে | v4 HTTP স্ট্যাটাস কোড এবং এরর বডি ব্যবহার করে । |
results.address_components.long_name / results.address_components.short_name | results.addressComponents.longText / results.addressComponents.shortText | নাম পরিবর্তন করা হয়েছে। |
results.geometry.location_type | results.granularity | নাম পরিবর্তন করা হয়েছে। |
results.geometry.location | results.location | ফিল্ডের নাম: lat / lng -> latitude / longitude । |
results.geometry.viewport | results.viewport | Field names: northeast / southwest -> high / low . |
results.postcode_localities | results.postalCodeLocalities | Renamed. Now returned for one or more localities (v3 required >1). |
results.partial_match | অপসারণ করা হয়েছে | |
| নতুন | results.addressComponents.languageCode | নির্দিষ্ট ঠিকানা উপাদানের ভাষা। |
| নতুন | results.bounds | high / low ব্যবহার করে সুস্পষ্ট সীমা নির্ধারণ করা হয়েছে। |
| নতুন | results.place | স্থানটির জন্য সম্পদের নাম। |
| নতুন | results.postalAddress | কাঠামোগত PostalAddress অবজেক্ট। |
v3 রিভার্স জিওকোডিং থেকে মাইগ্রেট করুন
If you use v3 Reverse Geocoding to turn coordinates into addresses, you should migrate to the v4 Reverse geocode a location method, which accepts a GET request.
The v4 API changes names, structure, and support for several parameters. We strongly recommend that you use a field mask to specify the fields you want returned in the response.
অনুরোধ প্যারামিটার পরিবর্তন
| v3 প্যারামিটার | v4 প্যারামিটার | নোট |
|---|---|---|
language | languageCode | নাম পরিবর্তন করা হয়েছে। |
region | regionCode | নাম পরিবর্তন করা হয়েছে। |
result_type | types | নাম পরিবর্তন করা হয়েছে; এতে পুনরাবৃত্ত কোয়েরি প্যারামিটার ব্যবহার করা হয়েছে। |
location_type | granularity | নাম পরিবর্তন করা হয়েছে; এতে পুনরাবৃত্ত কোয়েরি প্যারামিটার ব্যবহার করা হয়েছে। |
extra_computations | অপসারণ করা হয়েছে |
প্রতিক্রিয়া ক্ষেত্রের পরিবর্তন
| v3 ফিল্ড | ভি৪ ফিল্ড | নোট |
|---|---|---|
status , error_message | অপসারণ করা হয়েছে | v4 uses HTTP status codes and error bodies . |
results.address_components.long_name / results.address_components.short_name | results.addressComponents.longText / results.addressComponents.shortText | নাম পরিবর্তন করা হয়েছে। |
results.geometry.location_type | results.granularity | নাম পরিবর্তন করা হয়েছে। |
results.geometry.location | results.location | ফিল্ডের নাম: lat / lng -> latitude / longitude । |
results.geometry.viewport | results.viewport | Field names: northeast / southwest -> high / low . |
| নতুন | results.addressComponents.languageCode | নির্দিষ্ট ঠিকানা উপাদানের ভাষা। |
| নতুন | results.bounds | high / low ব্যবহার করে সুস্পষ্ট সীমা নির্ধারণ করা হয়েছে। |
| নতুন | results.place | স্থানটির জন্য সম্পদের নাম। |
| নতুন | results.postalAddress | কাঠামোগত PostalAddress অবজেক্ট। |
v3 স্থান ভূ-কোডিং থেকে স্থানান্তরিত করুন
If you use place_id to get the address for a specific Place ID with Geocoding v3, you must migrate to the v4 Place Geocoding method, which accepts a GET request.
The v4 API changes names, structure, and support for several parameters. We strongly recommend that you use a field mask to specify the fields you want returned in the response.
অনুরোধ প্যারামিটার পরিবর্তন
| v3 প্যারামিটার | v4 প্যারামিটার | নোট |
|---|---|---|
place_id | অনুরোধ প্রোটোতে ক্ষেত্র place | প্লেস আইডি এখন places/{place} পাথ প্যারামিটার হিসেবে প্রদান করা হয়, উদাহরণস্বরূপ: https://geocode.googleapis.com/v4/geocode/places/ChIJj61dQgK6j4AR4GeTYWZsKWw । এটি মূল রিকোয়েস্টের প্লেস ফিল্ডের সাথে ম্যাপ করা থাকে। |
language | languageCode | নাম পরিবর্তন করা হয়েছে। |
region | regionCode | নাম পরিবর্তন করা হয়েছে। |
প্রতিক্রিয়া ক্ষেত্রের পরিবর্তন
| v3 ফিল্ড | ভি৪ ফিল্ড | নোট |
|---|---|---|
status , error_message | অপসারণ করা হয়েছে | v4 HTTP স্ট্যাটাস কোড এবং এরর বডি ব্যবহার করে । |
results | (মূল) | v4 returns a single result object, not a results array. |
results.address_components.long_name / results.address_components.short_name | addressComponents.longText / addressComponents.shortText | নাম পরিবর্তন করা হয়েছে। |
results.geometry.location_type | granularity | নাম পরিবর্তন করা হয়েছে। |
results.geometry.location | location | ফিল্ডের নাম: lat / lng -> latitude / longitude । |
results.geometry.viewport | viewport | Field names: northeast / southwest -> high / low . |
results.postcode_localities | postalCodeLocalities | Renamed. Now returned for one or more localities (v3 required >1). |
| নতুন | addressComponents.languageCode | নির্দিষ্ট ঠিকানা উপাদানের ভাষা। |
| নতুন | bounds | high / low ব্যবহার করে সুস্পষ্ট সীমা নির্ধারণ করা হয়েছে। |
| নতুন | place | স্থানটির জন্য সম্পদের নাম। |
| নতুন | postalAddress | কাঠামোগত PostalAddress অবজেক্ট। |
Migrate from Geocoding Hyperlocal Data to Destinations
The following features in the Geocoding API v3 are being replaced by the SearchDestinations method of the Geocoding API v4:
- প্রবেশপথ
- নেভিগেশন পয়েন্ট
- ভবনের রূপরেখা
- মাঠ
If you were using the Geocoding API v3 for the above features, use this document to help you use the SearchDestinations method instead to get these features. This document explains where in the SearchDestinations response to find these features, and differences in how these features are represented in the API responses between the Geocoding API v3 and the SearchDestinations method of the Geocoding API v4.
প্রবেশপথ
To get the entrances associated with a destination , use the field destination.entrances .
Note that the format of an entrance is slightly different from the entrance format in the Geocoding API v3 . Each entrance in destination.entrances has the following fields:
-
displayName- this is a new optional field that will have a human readable name for the entrance, for example "Gate B". -
location- this is a location of typeLatLng, which is different from the format used in the Geocoding API v3. -
tags- this is the same as thetagsfield of the entrances from the Geocoding API v3. -
place- এটি জিওকোডিং এপিআই v3-এর প্রবেশপথেরbuildingPlaceIdফিল্ডের অনুরূপ। তবে, এই ফিল্ডের প্লেস আইডি যেকোনো ধরনের স্থানের জন্য হতে পারে, এটি কেবল একটি ভবনের জন্যই হতে হবে এমন কোনো বাধ্যবাধকতা নেই।
নেভিগেশন পয়েন্ট
To get the navigation points associated with a destination , use the field destination.navigationPoints .
উল্লেখ্য যে, একটি navigationPoint এর ফরম্যাটটি Geocoding API v3-এর নেভিগেশন পয়েন্ট ফরম্যাট থেকে কিছুটা ভিন্ন। destination.navigationPoints এর প্রতিটি নেভিগেশন পয়েন্টে নিম্নলিখিত ফিল্ডগুলো থাকে:
-
displayName- this is a new optional field that will have a human readable name for the navigation point, for example "5th Ave". -
location- this is a location of typeLatLng, which is different from the format used in the Geocoding API v3. -
travelModes- this is similar to therestrictedTravelModesfield of the navigation points from the Geocoding API v3. The possible enum values are the same, the only difference is that this field now represents the acceptable travel modes for the navigation point, rather than the restricted travel modes. -
usage- this is a new field which contains the use cases supported by the navigation point. Note that most navigation points will have anUNKNOWNusage, but that does not necessarily mean the navigation point's usage is restricted in any way.
ভবনের রূপরেখা
To get the building outlines associated with a destination , you should use the displayPolygon field of the placeView objects in the destination that represent buildings. For each placeView , you can check if it is a building with the placeView.structureType field. If the structure type is BUILDING , you can get the outline from the placeView.displayPolygon field. The placeView will also have additional fields for the building that were not in the Geocoding API v3.
A destination can have a placeView object that represents a building in the following fields:
-
destination.primary- this is the primary place for the destination. -
destination.containingPlaces- this is a repeated field that can hold larger places that "contain" the primary place. For example, if the primary place is asubpremise,containingPlaceswill usually hold theplaceViewrepresenting the building. -
destination.subDestinations- এটি একটি পুনরাবৃত্ত ক্ষেত্র যা মূল স্থানের উপ-গন্তব্যগুলো ধারণ করতে পারে। উদাহরণস্বরূপ, একটি ভবনের স্বতন্ত্র অ্যাপার্টমেন্ট ইউনিট। এই ক্ষেত্রটিতে সাধারণত কোনো ভবনের প্রতিনিধিত্বকারীplaceViewথাকবে না।
Note that the format of placeView.displayPolygon matches the building outline format in the Geocoding API v3 , which is the GeoJSON format, using the RFC 7946 format .
মাঠ
Similar to building outlines, to get the grounds associated with a destination , you should use the displayPolygon field of the placeView objects in the destination that represent grounds. For each placeView , you can check if it is a grounds with the placeView.structureType field. If the structure type is GROUNDS , you can get the outline from the placeView.displayPolygon field. The placeView will also have additional fields for the grounds that were not in the Geocoding API v3.
A destination can have a placeView object that represents a grounds in the following fields:
-
destination.primary -
destination.containingPlaces -
destination.subDestinations
Note that the format of placeView.displayPolygon matches the grounds outline format in the Geocoding API v3 , which is the GeoJSON format, using the RFC 7946 format .
এই বৈশিষ্ট্যগুলির অনুরোধ করতে একটি ফিল্ড মাস্ক ব্যবহার করুন।
The SearchDestinations method requires a field mask, as explained in Choose fields to return . The field mask can be set to * in order to return all fields, or you can set it to the specific fields you want to receive. For example, the following API request sets the field mask to receive all fields required to get the entrances, navigation points, building outlines, and grounds of a destination:
curl -X POST -d '{"place": "places/ChIJG3kh4hq6j4AR_XuFQnV0_t8"}' \
-H "X-Goog-Api-Key: API_KEY" \
-H "Content-Type: application/json" \
-H "X-Goog-FieldMask: destinations.entrances,destinations.navigationPoints,destinations.primary,destinations.containingPlaces,destinations.subDestinations" \
https://geocode.googleapis.com/v4/geocode/destinations
নিরাপত্তা সংক্রান্ত বিবেচনা
জিওকোডিং এপিআই ভি৪ একটি সার্ভার-টু-সার্ভার এপিআই হিসেবে ডিজাইন করা হয়েছে। জাভাস্ক্রিপ্ট ব্যবহারকারীদের জন্য ভি৩ থেকে ভি৪-এ সরাসরি মাইগ্রেশনের কোনো পথ নেই। এপিআই কী ব্যবহার করে ক্লায়েন্ট-সাইড জাভাস্ক্রিপ্ট থেকে (যেমন, ব্রাউজারে) সরাসরি ভি৪ মেথডগুলো কল করলে আপনার এপিআই কী চুরি এবং অপব্যবহারের উচ্চ ঝুঁকিতে পড়ে।
HTTP referrer restrictions, while useful, are not sufficient protection for web service endpoints as they can be trivially bypassed by attackers who forge the Referer header in their requests.
সুপারিশকৃত পদ্ধতি
জিওকোডিং এপিআই ভি৪ ব্যবহারের প্রস্তাবিত উপায় হলো আপনার নিজস্ব ব্যাকএন্ড সার্ভার থেকে এটি ব্যবহার করা। আপনার ক্লায়েন্ট অ্যাপ্লিকেশনটি এই মধ্যবর্তী সার্ভারে অনুরোধ পাঠাবে, যা পরবর্তীতে একটি সুরক্ষিত এপিআই কী (উদাহরণস্বরূপ, এনভায়রনমেন্ট ভেরিয়েবল বা সিক্রেট ম্যানেজারে সংরক্ষিত একটি কী) ব্যবহার করে নিরাপদে গুগল এপিআই-কে কল করে। এটি নিশ্চিত করে যে আপনার এপিআই কী ফ্রন্টএন্ড কোডে কখনোই প্রকাশ পাবে না।
ক্লায়েন্ট-সাইডের প্রয়োজনের জন্য বিকল্প
If you have client-side needs that require geocoding, consider using one of the existing client-side solutions:
- Geocoding Service in the Maps JavaScript API: The Geocoding Service continues to use the v3 backend and is designed for use in a browser environment.
- Places UI Kit: Use the Places UI Kit , including Place Autocomplete elements , for address-related user interface elements.