Archive for the 'Google Maps' Category

Finding the closest Melbourne CBD train station with GDirections

Finding the closest Melbourne CBD train station with GDirections

This application came from my dependence on public transport and possible need to move houses; I wanted to know how close I would be in relation to train stations. There are quite a number of stations in Melbourne, and I don’t have the time to map all of their coordinates, so at the time being it only has train stations from the City Loop.

The application uses GDirections. It lets us load way points and retrieve the route details; such as distance, driving directions, and even an HTML summary of the travel.

I used GDirections in two instances of the application:
1. To determine the distance between my pivot position and the train stations.
2. To plot the route of my pivot point to the closest train station

Continue reading ‘Finding the closest Melbourne CBD train station with GDirections’

Adding Markers on Google Maps (with more functionalities)

I modified my previous markers example to show off further functionalities:

  • To pop up an info window with marker description.
  • To handle clicks and create new markers.
  • To use markers with custom images.

Extended Google Map Markers

Continue reading ‘Adding Markers on Google Maps (with more functionalities)’

Adding Markers on Google Maps

I created an example of a Google Map application where you can plot markers on the map by specifying coordinates.

Google Map Markers

Creating markers is fairly simple:

1. Create a new instance of GLatLng object. The GLatLng holds the coordinates of your marker.

// create new location object
var location = new GLatLng(latitude, longitude);

2. Create a new instance of GMarker with the GLatLng object.

// place new marker
var marker = new GMarker(location);

3. Use the addOverlay method to create a new overlay in the map.

map.addOverlay(marker);

Just like we add an overlay to create a marker, we clear a marker by removing an overlay.

map.removeOverlay(markersArray[idx]);

The markersArray[idx] is the GMarker we would like to remove. If you are not using an array to keep your markers, you can pass in an instance of GMarker directly.


Hello

My name is Marcel Tjandraatmadja, and I live in Melbourne, Australia. I have a special interest in PHP and web applications.
I also enjoy problem solving with C#, C, and C++.

My interests are also Aikido, roller blading, and music from my favorite bands.

Curriculum Vitae

Download my CV here.

Contact

Drop me a message at marcel.tjandra@gmail.com.

my del.icio.us

Posts

html hit counter