Search
MapView.latLongToClient Method
See Also
 






Converts the specified geographic coordinates to a client position.

Namespace: MindFusion.Mapping
File: MapView.js

 Syntax

JavaScript  Copy Code

function latLongToClient (location)

 Parameters

location

LatLong. The location to convert.

 Return Value

Point. A Point instance representing The client point.

 Example

The following example creates a new MapView using a <DIV> element called "mapview" that we've declared in the HTML code of the page. Then it handles its click event, gets its location and assigns it as an offset to a Marker instance:

JavaScript  Copy Code

var m = MindFusion.Mapping;

// create a new instance of the mapView
var view = new m.MapView(document.getElementById("mapView"));
view.theme = "light";

var markers = new m.DecorationLayer("Images");

// create some markers with images
var mark = new m.Marker(new m.LatLong(-22.951916, -43.210487));
mark.imageSrc = "./images/christ_redeemer.png";
mark.text = "Christ the Redeemer";
mark.visible = false;
markers.decorations.add(mark);

view.layers.add(markers);

view.click.addEventListener(mapViewClickHandler);

function mapViewClickHandler( sender, args )
{
      var l = view.latLongToClient( args.location );
      mark.offset = l;
}

 See Also