USE SPRING REST AND JACKSONXML TO ACCESS GOOGLE MAPS ROADS API (TUTORIAL AND EXAMPLE)

simple

February 29, 2016

General

In the following tutorial we will integrate access to the REST/JSON API of GOOGLE MAPS ROADS in a Java Web Application. Please setup before an appropriate environment as this tutorial requires you to use a current Java Development Kit JDK, the Netbeans IDE and a working Tomcat Installation as described in the Prerequisites.

Tutorial
Step 1. – Integrate Spring REST and JacksonXML

Either create a new project e.g. “GoogleMapsRoads” or use an existing one. The type of the application should be a Java Web application with Maven build support.

  1. Now open the folder “Project Files” and edit the “pom.xml”. We need to add additional dependencies to have support for the frameworks we want to use – here Spring REST, Jackson XML and the ModelMapper

As we use the Spring dependecyManagement it is necessary to but this information also in the pom.xml

You should be now able to start a maven build, which will take some time to download the dependencies.

Tutorial
Step 2. – Integrate Spring REST and JacksonXML
We now create a package called google under our base package path e.g. org.company.project.google

Under this package we then create a new Java class called Coordinate3D . This class will contain our 3D location as latitude (y), longitude (x) and altitude (z). The road snapping will only need the x,y coordinates, but for future use we already did put in the z axis.

Under this package we then create a new Java class called GoogleMapsRoadsApi

To get the API working you need a GOOGLE_MAPS_ROADS_API_KEY from google. You will have to register and create a new application at google’s API website.

To test the API we will set up a Unit Test, therefore we open the test packages folder and create a new package path org.company.project.google
Under this package path we then create our new test class called GoogleMapsRoadsApiJUnitTest and add the following to test the API access:

References

Related Posts

Use Spring REST and JacksonXML to access Foursquare (Tutorial and Example)

simple

January 24, 2016

General

In the following tutorial we will integrate access to the REST/XML API of Foursquare in a Java Web Application. Please setup before an appropriate environment as this tutorial requires you to use a current Java Development Kit JDK, the Netbeans IDE and a working Tomcat Installation as described in the Prerequisites. Tutorial Step 1. – Integrate […]

Read More

Lichtschächte, Oberlichter … or the SolaTube

simple

May 16, 2007

General

No Comment

Energy saving is obviously one of the top one things – people should think about nowadays! The solatube is not a top notch saver, but it is simple, elegant and so cheap – that you might think about it before building your house or rebuilding your rooms. http://www.velux.de/Produkte/Tageslicht-Spot/Aufbau+und+Zubeh%C3%B6r/ http://www.bauen.de/um-ausbau-infocenter/fenster/single/artikel/lichtdurchflutete-raeume-ohne-f.html http://www.interferenz.de/solatube/index.htm technorati tags:construction, housing

Read More

RSS RSS Feed

  • An error has occurred, which probably means the feed is down. Try again later.

Categories

Tags