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.
How to get the number of digits in Python
[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 ()
Measure the execution result of the program in C ++, Java, Python.
The result of Java engineers learning machine learning in Python www
How to implement Java code in the background of RedHat (LinuxONE)
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
How to use the C library in 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
To get the path of the currently running python.exe
[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
How to get the variable name itself in python
I want to grep the execution result of strace
[python] Get the list of classes defined in the module
Get the result in dict format with Python psycopg2
Get to know the feelings of gradient boosting trees
Get the size (number of elements) of UnionFind in Python
How to use the exists clause in Django's queryset
Try to get the contents of Word with Golang
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
Use hash to lighten collision detection of about 1000 balls in Python (related to the new coronavirus)
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
I tried to create a Python script to get the value of a cell in Microsoft Excel
How to pass the execution result of a shell command in a list in Python (non-blocking version)
Use DataFrame in Java
One liner to get the nth commit hash in Git
How to find the optimal number of clusters in k-means
Try to get the function list of Python> os package
I tried to get the location information of Odakyu Bus