Zadbaj o dobrą organizację dzięki kolekcji
Zapisuj i kategoryzuj treści zgodnie ze swoimi preferencjami.
Deweloperzy z Europejskiego Obszaru Gospodarczego (EOG)
Geocoding API to usługa, która akceptuje miejsce jako adres, współrzędne geograficzne lub identyfikator miejsca. Konwertuje adres na współrzędne szerokości i długości geograficznej oraz identyfikator miejsca lub konwertuje współrzędne szerokości i długości geograficznej lub identyfikator miejsca na adres.
Dlaczego warto korzystać z interfejsu Geocoding API
Używaj interfejsu Geocoding API w przypadku witryny lub aplikacji mobilnej, gdy chcesz używać danych geokodowania na mapach udostępnianych przez jeden z interfejsów API Google Maps Platform.
Za pomocą interfejsu Geocoding API możesz używać adresów do umieszczania znaczników na mapie lub konwertować znaczniki na mapie na adresy. Ta usługa służy do geokodowania wstępnie zdefiniowanych adresów statycznych na potrzeby umieszczania treści aplikacji na mapie.
Co możesz robić za pomocą interfejsu Geocoding API
Za pomocą interfejsu Geocoding API możesz uzyskać dane geokodowania dla jednego lub większej liczby adresów lub miejsc, w tym:
Współrzędne geograficzne adresów.
adresy dla zestawów współrzędnych szerokości i długości geograficznej;
adresy odpowiadające identyfikatorom miejsc;
Możesz określić, gdzie mają się wyświetlać wyniki, i ograniczyć je do konkretnego regionu, powiatu lub kodu pocztowego.
Jak działa Geocoding API
Interfejs Geocoding API wykonuje zarówno geokodowanie, jak i odwrotne geokodowanie:
Geokodowanie: konwertuje adresy takie jak „1600 Amphitheatre Parkway, Mountain View, CA” na współrzędne geograficzne lub identyfikatory miejsc. Możesz używać tych współrzędnych do umieszczania znaczników na mapie lub do jej wyśrodkowania lub przemieszczania w ramce widoku.
Odwrotne geokodowanie: konwertuje współrzędne szerokości i długości geograficznej lub identyfikator miejsca na adres zrozumiały dla człowieka. Adresów możesz używać w różnych sytuacjach, np. podczas dostawy lub odbioru.
W tym demonstracyjnym kodzie, który korzysta z usługi geokodowania za pomocą interfejsu Maps JavaScript API, pokazujemy, jak działa interfejs Geocoding API. Aby wyświetlić więcej opcji i szczegółów, otwórz mapę na osobnej karcie.
Zasoby
Tabela poniżej zawiera podsumowanie zasobów dostępnych za pomocą interfejsu Geocoding API wraz z danymi zwracanymi przez poszczególne punkty końcowe.
Zwraca adres, jego komponenty i typy. Zapoznaj się z odpowiedziami na odwrotne geokodowanie w przewodniku po prośbach o geokodowanie miejsc i odpowiedziach na nie.
Jak korzystać z Geocoding API
1
Konfiguracja
Zacznij od skonfigurowania projektu Google Cloud i wykonaj podane niżej instrukcje konfiguracji.
2
Wypróbuj geokodowanie
Gdy masz klucz API, możesz zacząć testować Geocoding API bezpośrednio z poziomu curl lub przeglądarki. Aby przeprowadzić wyszukiwanie adresu lub komponentu, musisz podać odpowiednie parametry wyszukiwania. Więcej informacji znajdziesz w sekcji Parametry geokodowania.
3
Wypróbuj odwrotne geokodowanie
Podaj współrzędne geograficzne wraz z kluczem interfejsu API, aby uzyskać elementy adresu odpowiadające najbliższemu adresowi w formie zrozumiałej dla człowieka.
Więcej informacji znajdziesz w sekcji Wymagania dotyczące odwrotnego geokodowania.
4
Podstawy odpowiedzi
Wszystkie punkty końcowe interfejsu Geocoding API zwracają te same dane w formacie JSON lub XML.
Informacje o danych, kodach stanu i komunikatach o błędach znajdziesz w artykule Odpowiedzi na geokodowanie.
5
Uwzględnij dane geokodowania w swojej aplikacji.
Dane geokodowania możesz wykorzystać do uzyskiwania adresów ze znaczników na mapie lub do umieszczania na mapie znaczników na podstawie znanego adresu.
Dostępne biblioteki klienta
Wywołuj ten interfejs API w wybranym języku za pomocą jednej z tych bibliotek klienta:
Biblioteki klienta Java, Python, Go i Node.js do usług Map Google są obsługiwane przez społeczność i udostępniane na licencji Apache 2.0.
Pobierz je z GitHuba, gdzie znajdziesz też instrukcje instalacji i przykładowy kod.
[[["Łatwo zrozumieć","easyToUnderstand","thumb-up"],["Rozwiązało to mój problem","solvedMyProblem","thumb-up"],["Inne","otherUp","thumb-up"]],[["Brak potrzebnych mi informacji","missingTheInformationINeed","thumb-down"],["Zbyt skomplikowane / zbyt wiele czynności do wykonania","tooComplicatedTooManySteps","thumb-down"],["Nieaktualne treści","outOfDate","thumb-down"],["Problem z tłumaczeniem","translationIssue","thumb-down"],["Problem z przykładami/kodem","samplesCodeIssue","thumb-down"],["Inne","otherDown","thumb-down"]],["Ostatnia aktualizacja: 2025-08-31 UTC."],[[["\u003cp\u003eThe Geocoding API converts addresses into geographic coordinates (latitude and longitude) and vice versa.\u003c/p\u003e\n"],["\u003cp\u003eThis API is ideal for placing markers on maps based on addresses and retrieving addresses from map locations for static content, not dynamic user input.\u003c/p\u003e\n"],["\u003cp\u003eYou can use the Geocoding API to find geographic coordinates for addresses, addresses for coordinates, and addresses for Place IDs.\u003c/p\u003e\n"],["\u003cp\u003eThe API supports both geocoding (address to coordinates) and reverse geocoding (coordinates to address).\u003c/p\u003e\n"],["\u003cp\u003eClient libraries are available in Java, Python, Go, and Node.js for easy integration into your applications.\u003c/p\u003e\n"]]],[],null,["**European Economic Area (EEA) developers** If your billing address is in the European Economic Area, effective on 8 July 2025, the [Google Maps Platform EEA Terms of Service](https://cloud.google.com/terms/maps-platform/eea) will apply to your use of the Services. Functionality varies by region. [Learn more](/maps/comms/eea/faq). \n\nThe Geocoding API is a service that accepts a place as an\naddress, latitude and longitude coordinates, or Place ID. It converts the\naddress into latitude and longitude coordinates and a Place ID, or converts\nlatitude and longitude coordinates or a Place ID into an address.\n| **Note** : If you only want plus codes and don't want to use an API key, you can use the [Plus codes API](https://github.com/google/open-location-code/tree/main/Documentation).\n\nWhy use the Geocoding API\n\nUse the Geocoding API for website or mobile application when you want to use\ngeocoding data within maps provided by one of the Google Maps Platform APIs.\nWith the Geocoding API, you use addresses to place markers on a map, or\nconvert a marker on a map to an address. This service is designed for geocoding\n**predefined, static addresses** for placement of application\ncontent on a map.\n| This service is **not** designed to respond directly to user\n| input. To do dynamic geocoding, for example, in a user interface, see the\n| [Maps JavaScript API\n| client geocoder](/maps/documentation/javascript/geocoding) and/or the\n| [Google Play services Location APIs](https://developer.android.com/google/play-services/location.html).\n\nWhat you can do with the Geocoding API\n\nYou can use the Geocoding API to obtain geocoding data for one or more addresses or\nplaces, including the following:\n\n- Geographic coordinates for addresses.\n- Addresses for sets of latitude and longitude coordinates.\n- Addresses for place IDs.\n\nYou can control where the results appear and constrain the results to a particular region,\ncounty, or postal code.\n\nHow the Geocoding API works\n\nThe Geocoding API does both geocoding and reverse geocoding:\n\n- [**Geocoding**](/maps/documentation/geocoding/requests-geocoding): Converts addresses such as \"1600 Amphitheatre Parkway, Mountain View, CA\" into latitude and longitude coordinates or Place IDs. You can use these coordinates to place markers on a map, or to center or reposition the map within the view frame.\n- [**Reverse geocoding**](/maps/documentation/geocoding/requests-reverse-geocoding): Converts latitude/longitude coordinates or a Place ID into a human-readable address. You can use addresses for a variety of scenarios, including deliveries or pickups.\n\nThe following demo uses the Geocoding Service through the Maps JavaScript API\nto demonstrate how the Geocoding API works. Open the map in a separate tab\nto see more options and details.\n\nResources\n\nThe following table summarizes the resources available through the\nGeocoding API along with the data each endpoint returns.\n\n| Data resources | Data returned | Return format |\n|-------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------|\n| [Geocoding](/maps/documentation/geocoding/requests-geocoding) | Returns address, address components, and address types. See [Results](/maps/documentation/geocoding/requests-geocoding#results) in the *Geocoding request and response* guide. | - JSON - XML |\n| [Reverse geocoding](/maps/documentation/geocoding/requests-reverse-geocoding) | Returns address, address components, and address types. See [Reverse geocoding responses](/maps/documentation/geocoding/requests-reverse-geocoding#reverse-response) in the Reverse geocoding request and response guide. | - JSON - XML |\n| [Place geocoding](/maps/documentation/geocoding/requests-places-geocoding) | Returns address, address components, and address types. See [Reverse geocoding responses](/maps/documentation/geocoding/requests-places-geocoding) in the Place geocoding request and response guide. | - JSON - XML |\n| - JSON - XML |\n\nHow to use the Geocoding API\n\n|---|---------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| 1 | **Get set up.** | Start with [Set up your Google Cloud project](/maps/documentation/geocoding/cloud-setup) and complete the setup instructions that follow. |\n| 2 | **Try a geocoding request** | Once you have an API key, you can start testing out the Geocoding API directly from curl or a browser. You'll need to supply the correct lookup parameters for address or component lookups. See [Geocoding parameters](/maps/documentation/geocoding/requests-geocoding#geocoding-lookup) for details. |\n| 3 | **Try a reverse geocoding request** | Supply latitude/longitude coordinates along with your API key to obtain address components for the closest human-readable address for that location. See [Reverse geocoding requests](/maps/documentation/geocoding/requests-reverse-geocoding#reverse-requests) for details. |\n| 4 | **Understand response basics** | All endpoints in the Geocoding API return the same data in either JSON or XML. See [Geocoding responses](/maps/documentation/geocoding/requests-geocoding#GeocodingResponses) for an explanation of the data, status codes, and error messages. |\n| 5 | **Incorporate geocoding data into your own app!** | You can use geocoding data to obtain addresses from map markers or to supply markers on a map based on a known address. |\n\nAvailable client libraries\n\nCall this API in the language of\nyour choice through one of the following client libraries:\n\n- [Java\n Client for Google Maps Services](https://github.com/googlemaps/google-maps-services-java)\n- [Python\n Client for Google Maps Services](https://github.com/googlemaps/google-maps-services-python)\n- [Go Client\n for Google Maps Services](https://github.com/googlemaps/google-maps-services-go)\n- [Node.js\n Client for Google Maps Services](https://github.com/googlemaps/google-maps-services-js)\n\nThe Java Client, Python Client, Go Client and Node.js Client for Google Maps\nServices are community-supported client libraries, open sourced under the\n[Apache 2.0 License](http://www.apache.org/licenses/LICENSE-2.0).\nDownload them from GitHub, where you can also find installation instructions and sample code.\n\nWhat's next\n\n- **Start using the Geocoding API** : Go to [Set up your\n Google Cloud project](/maps/documentation/geocoding/cloud-setup).\n- **Get started with sample requests and responses** : Go to [Geocoding requests and responses](/maps/documentation/geocoding/requests-geocoding)\n- **Follow best practices** : Go to [Geocoding Addresses Best\n Practices](/maps/documentation/geocoding/best-practices)."]]