Stay organized with collections Save and categorize content based on your preferences.
You can use the Places Service and the Geocoding API with the Maps SDK for Android to search for regions, and get more information about places. The Places Service and Geocoding API are powerful and stable alternatives for obtaining place IDs. If you're already using place IDs, you can reuse those IDs with data-driven styling for boundaries.
Add the Places Service and Geocoding to your Maps SDK for Android apps in the following ways:
You can use Text Search (New) REST API in the Places API to get a place ID that includes region data by specifying places.id
in the field mask. Usage of the Text Search (New) to request place IDs only incurs no charge. Learn more.
For example, to get the place ID for Trinidad, CA you can make the following API call:
curl -X POST -d '{ "textQuery" : "Trinidad, CA" }' \ -H 'Content-Type: application/json' -H 'X-Goog-Api-Key: API_KEY' \ -H 'X-Goog-FieldMask: places.id' \ 'https://places.googleapis.com/v1/places:searchText'Use Places Autocomplete to find regions
The Places Autocomplete service in the Places SDK for Android provides a convenient way to let your users search for regions. To configure the Places Autocomplete service to return only regions, use AutocompleteSupportFragment.setTypesFilter(List)
to set the type filter to PlaceTypes.REGIONS
.
The Place Details service in the Places SDK for Android returns data for a region can be quite useful. For example, you can:
locality
).The Geocoding API lets you convert an address into latitude and longitude coordinates and a Place ID, or converts latitude and longitude coordinates or a Place ID into an address. The following uses combine well with data-driven styling for boundaries:
The following example uses an address (url-escaped) to make a request to the Geocoding API:
https://maps.googleapis.com/maps/api/geocode/json?address=1600%20Amphitheatre%20Pkwy%20Mountain%20View%20CA&key=YOUR_API_KEY
You can use reverse geocoding to find place IDs. The following example Geocoding service function returns the place IDs for all address components at the specified latitude and longitude coordinates:
https://maps.googleapis.com/maps/api/geocode/json?latlng=41.864182,-87.676930&key=YOUR_API_KEY
Use reverse geocoding with component filtering to get the address component for one or more of the following types at the specified location:
administrativeArea
country
locality
postalCode
The next example function shows using the Geocoding service, adding component restrictions with reverse geocoding to get all of the address components at the specified location for only the locality
type:
https://maps.googleapis.com/maps/api/geocode/json?latlng=41.864182,-87.676930&result_type=locality&key=YOUR_API_KEY
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2025-08-14 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-14 UTC."],[[["You can use the Places Service and Geocoding API with the Maps SDK for Android to find place IDs for regions and get more information about them for data-driven styling."],["The Places SDK for Android, Places API, and Geocoding API can be used to search for regions and retrieve their details, including place IDs, viewport, feature type, and formatted address."],["Text Search (New) in the Places API, Places Autocomplete in the Places SDK for Android, and the Geocoding API are methods for obtaining place IDs."],["When using these services, be aware that the Places SDK for Android, Places API, and Geocoding API require enabling and are billed separately from the Maps SDK for Android."]]],[]]
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4