Skip to content

Latest commit

 

History

History
47 lines (34 loc) · 2.01 KB

README.md

File metadata and controls

47 lines (34 loc) · 2.01 KB

tests.pluscodes

Simple java offline implementation of pluscodes

What does this code do

It converts a latitude and longitude into a PlusCode, in three formats: Full, Within and Shortened. The conversion is made offline, without any remote API call.

What this code doesn't do

It does not shows a semantic form of address, with city name, country name, or other names, like streets, avenues, or even house numbers.

References

Building

Before start, check the basic requirements: Java 8 or higher and Maven

$ git clone https://github.com/google/open-location-code
$ cd open-location-code/java/
$ cd ../../
$ git clone https://github.com/Scicrop/tests.pluscodes
$ cd tests.pluscodes
$ mvn package

If you are using Eclipse IDE and have this problem: Plugin execution not covered by lifecycle configuration: com.diffplug.spotless:spotless-maven-plugin:1.23.0:check (execution: spotless, phase: compile) in the pom.xml from open-location-code package you can just comment the <execution> block inside pom.xml.

Running

$ java -jar target/tests.pluscodes-0.0.1-jar-with-dependencies.jar -23.982528 -46.916556

Live CLI

Results

Based on the above example, that uses this location: -23.982528 -46.916556. You can see in the following images, that both latitude/longitude and pluscode points to the same location.

By lat lng https://www.google.com.br/maps/place/588M238M%2BX9/@-23.98256,-46.9176568,336m/data=!3m1!1e3!4m5!3m4!1s0x0:0x0!8m2!3d-23.9825625!4d-46.9165625

By pluscode https://www.google.com.br/maps/place/23%C2%B058'57.1%22S+46%C2%B054'59.6%22W/@-23.982528,-46.9187447,671m/data=!3m2!1e3!4b1!4m5!3m4!1s0x0:0x0!8m2!3d-23.982528!4d-46.916556