Use the Java SDK of GoogleMapsAPI to get the result of reverse GeoCoding in Japanese.

Introduction

I wrote a process to get an address from latitude and longitude using GoogleMapsAPI. The Java SDK is provided by Google. It is a memo writing setting to return the address in Japanese.

Java SDK

https://github.com/googlemaps/google-maps-services-java

Source code

    public String reverceGeocoding(double lat, double lon) {
        LatLng latlng = new LatLng(lat, lon);

        GeoApiContext context = new GeoApiContext.Builder().apiKey(apikey).build();
        GeocodingApiRequest request = GeocodingApi.reverseGeocode(context, latlng).language("ja");
        GeocodingResult[] results;
        String address = null;
        try {
            results = request.await();
            Gson gson = new GsonBuilder().setPrettyPrinting().create();
            address = gson.toJson(results[0].formattedAddress);
        } catch (ApiException | InterruptedException | IOException e) {
            e.printStackTrace();
        } finally {
            context.shutdown();
        }
        return address;
    }

in conclusion

There is nothing I can do once I make it, but I investigated how to specify the language. I will leave it as a reminder.

Recommended Posts

Use the Java SDK of GoogleMapsAPI to get the result of reverse GeoCoding in Japanese.
Use pygogo to get the log in json.
[Implementation explanation] How to use the Japanese version of BERT in Google Colaboratory (PyTorch)
linux / c> link> Get the execution result of the shell command in the C program> I was taught how to use popen ()
The result of Java engineers learning machine learning in Python www
Use PyCaret to predict the price of pre-owned apartments in Tokyo!
How to get the vertex coordinates of a feature in ArcPy
Create a function to get the contents of the database in Go
Click the Selenium links in order to get the elements of individual pages
[Linux] Command to get a list of commands executed in the past
The result of installing python in Anaconda
I want to batch convert the result of "string" .split () in Python
R: Use Japanese instead of Japanese in scripts
I want to use the Qore SDK to predict the success of NBA players
I want to use Python in the environment of pyenv + pipenv on Windows 10
Use twitter API to get the number of tweets related to a certain keyword
I want to store the result of% time, %% time, etc. in an object (variable)
How to get a list of files in the same directory with python
Use the MediaWiki API to get Wiki information
Get the caller of a function in Python
View the result of geometry processing in Python
Summary of how to use MNIST in Python
How to get the files in the [Python] folder
[Python] Get the day of the week (English & Japanese)
Use os.getenv to get environment variables in Python
Summary from the beginning to Chapter 1 of the introduction to design patterns learned in the Java language
[python] Get the list of classes defined in the module
Get the result in dict format with Python psycopg2
Get the size (number of elements) of UnionFind in Python
How to use the exists clause in Django's queryset
Let's use the open data of "Mamebus" in Python
Check for the existence of BigQuery tables in Java
How to use the model learned in Lobe in Python
Script to get the expiration date of the SSL certificate
Get the URL of the HTTP redirect destination in Python
To do the equivalent of Ruby's ObjectSpace._id2ref in Python
Use date to x-axis of tsplot depicted in seaborn
How to use Spacy Japanese model in Google Colaboratory
I want to use the R dataset in python
manage to get rid of heavy pyls in vim-lsp
Get the value of a specific key up to the specified index in the dictionary list in Python
I made a class to get the analysis result by MeCab in ndarray with python
[OCI] Python script to get the IP address of a compute instance in Cloud Shell
[Super easy! ] How to display the contents of dictionaries and lists including Japanese in Python
How to pass the execution result of a shell command in a list in Python (non-blocking version)
Survey on the use of machine learning in real services
How to use the __call__ method in a Python class
[Hyperledger Iroha] Notes on how to use the Python SDK
[Updated from time to time] Summary of design patterns in Java
Get the number of specific elements in a python list
I want to get the operation information of yahoo route
Sort the string array in order of length & Japanese syllabary
Comparison of how to use higher-order functions in Python 2 and 3
How to get the last (last) value in a list in Python
How to get all the keys and values in the dictionary
How to get a list of built-in exceptions in python
Get the number of occurrences for each element in the list
Make the function of drawing Japanese fonts in OpenCV general
Get all IP addresses of instances in the autoscaling group
Notes on how to use marshmallow in the schema library
Keras I want to get the output of any layer !!