Markers are created using ImageObjects – an ImageObject is an image assigned to a map location. As the map pans and zooms, ImageObjects remain geographically anchored.

The following code snippet creates an ImageObject named pin.

  • The layer value specifies a map layer to place the pin on. By grouping markers on different layers you can choose to hide all, say, restaurant markers at once by simply hiding the appropriate layer. However, in this case we specify a map widget as the layer. The ImageObject class allows us to do this.
  • The location value specifies a fixed geographical map location
  • The src value specifies an image to use for the pin.
pin = new Telogis.GeoBase.MapLayers.ImageObject ({
        layer: map,
        location: new Telogis.GeoBase.LatLon(33.581218, -117.72681),
        src: 'images/pushpin-red.gif'
});

Published, Jun 28th 2010, 15:36

Tagged under: javascript maps