Showing posts with label geocoder. Show all posts
Showing posts with label geocoder. Show all posts

Sunday, February 20, 2011

GPS Visualiser

One of the online tools I use regularly while working with GPX files and mapping is the GPS Visualizer website. The GPS Visualizer website is a collection of tools that work with GPX files to produce maps and profiles of GPS tracks.

The main functions I use on the website are:

1. Draw a Map

The Draw a Map page allows you to select a GPX file and display it overlayed on a variety of different map types including Google Streetmap, Google Satellite and Google Terrain. Once created the image can be captured as an image file.

2. Draw a Profile

The Draw a Profile page allows you to select a GPX file and display a elevation profile for this GPX file. The profile can be colorcoded to show elevation, speed, heart rate and other data points. Where a GPX file does not include elevation data the form gives the ability to add elevation data from a DEM dataset.

3. Lookup Elevations

The Lookup Elevation page allows you to recreate the elevation data for a GPX track using a DEM dataset. This is useful if the existing GPX file does not have elevation data or the data is incomplete. Rather than directly rendering a profile (as in point 2) the page gives you the option to save a new GPX file.

As well as these easy to use functions there are a multitude of ways to make use of the GPS Visualizer service. If you are using GPX files on a regular basis this service is a very handy addition to your tools.

Saturday, November 7, 2009

Using JAK and Google Geocoder Part 2

In this second post about using JAK and Google Geocoder I have included a new application that processes a CSV file containing a list of descriptions and addresses. It uses a library from http://ostermiller.org/utils/ which simplifies the reading of CSV files.

The following code snippet shows the usage of the CSVParser class from OsterMiller.org.

String addresses[][] = null;
try {
   CSVParser csv = new CSVParser(new FileReader("restaurants.csv"));
     try {
         addresses = csv.getAllValues();
         } catch (IOException ex) {
         Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex);
         }
   } catch (FileNotFoundException ex) {
      Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex);
      }

Once the string array has been loaded with values we can iterate through the array and use the Geocoder class to find the latitude and longitude of each of the addresses in the file. The code below shows this process and the adding each of the placemarks into the KML file.

for (int i=0; i<addresses.length; i++){
  try {            
      location1 = Geocoder.getLocation(addresses[i][1]).toString();
      } catch (IOException ex) {
         Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex);
      }
      final Placemark placemark1 = document.createAndAddPlacemark()
                  .withName(addresses[i][0])
                  .withDescription(addresses[i][1] + addresses[i][2]);
      placemark1.createAndSetPoint().addToCoordinates(location1);
      }

The full code for this project is here. I hope that you find it useful.