Marker Support

Modest Maps can help you place markers in geographical locations, but provides no built-in marker display. Between the 1.0 beta release and the forthcoming 1.0 final release, we've added some improved methods for attaching marker clips.

Current (1.0 Beta)

In the current beta release, marker placement and tracking is entirely outside the scope of Modest Maps. com.modestmaps.Map has two methods for handling markers:

putMarker(id:String, location:Location):Void:

  • Accepts an opaque id string for reference, and a geographic location.
  • Marker is tracked internally by id, and when its enclosing tile appears or disappears, the events EVENT_MARKER_ENTERS and EVENT_MARKER_LEAVES are dispatched by Map. These two events include the original id string and geographic location.
  • For correct placement of marker clips, the following events should be observed: EVENT_START_ZOOMING, EVENT_STOP_ZOOMING, EVENT_ZOOMED_BY, EVENT_START_PANNING, EVENT_STOP_PANNING, EVENT_PANNED_BY, EVENT_RESIZED_TO. Marker clips, or a clip that contains them, should be moved in response to these events.
  • See source:branches/1.0b/as2/lib/com/modestmaps/Map.as@196#L504

removeMarker(id:String):Void:

Soon (1.0 Final)

In the forthcoming 1.0 final release, putMarker() has one additional, optional argument, and we added the method getMarker(). These changes are reflected on the AS3 branch:

putMarker(id:String, location:Location, symbol:String):MovieClip:

  • Accepts an opaque id string for reference, a geographic location, and an optional linkage name of the movie clip symbol in the library.
  • The linkage name is passed on as the first argument to MovieClip.attachMovie(). The attached clip is returned by putMarker().
  • For simple marker placement, the events described above are handled internally (see com.modestmaps.core.MarkerClip), and can be entirely ignored. The attached clip is shown in its proper geographical location on the map. It moves in response to pans and zooms, and is masked to the edge of the map.
  • See source:branches/AS3/as2/lib/com/modestmaps/Map.as@272#L530

getMarker(id:String):MovieClip: