Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cyrillic address request using Google Geocoding API

I'm learning how to use google geocoding API in java. I've decided to use json format response, but faced some difficulties. An app should convert string address to latitude and longitude.

The example adress from google documentation (1600 Amphitheatre Parkway, Mountain View, CA) works just fine, but when I'm trying to request by adress in Cyrillic (for ex. 12 Пушкина, Москва), I get

INVALID_REQUEST

status.

I should notice, that the same request works fine in browser. So I wonder if there any way to request by Cyrillic address from java.

like image 523
mol Avatar asked Feb 23 '26 16:02

mol


1 Answers

You'll need to encode the address for use in a URL. I can't tell you which method to use in java(but I'm sure there is one).

In the end it should look like this:

http://maps.googleapis.com/maps/api/geocode/json?address=12%20%D0%9F%D1%83%D1%88%D0%BA%D0%B8%D0%BD%D0%B0%2C%20%D0%9C%D0%BE%D1%81%D0%BA%D0%B2%D0%B0&sensor=false

like image 61
Dr.Molle Avatar answered Feb 26 '26 05:02

Dr.Molle



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!