Skip to content
This repository was archived by the owner on Oct 21, 2024. It is now read-only.

Modest Maps Reference

tmcw edited this page Nov 18, 2011 · 2 revisions

Point

Point is a pixel position on screen, expressed as a simple pair of numbers. The methods of Map that convert to/from points work relative to the map's containing div element. This is used to locate the pixel within the map, starting at (0, 0) in the upper-lefthand corner.

API

Constructor

{% highlight js %}var point = new com.modestmaps.Point(x, y){% endhighlight %}

Class Methods

{% highlight js %}com.modestmaps.Point.interpolate(p1, p2, t){% endhighlight %}

Get a point between two other points, biased by t.

Location

Location is a geographical latitude and longitude, expressed as a simple pair of numbers. For example, San Francisco is near 37°N, 122°W or new com.modestmaps.Location(37, -122).

API

Constructor

{% highlight js %}new com.modestmaps.Location(lat, lon){% endhighlight %}

Class Methods

{% highlight js %}com.modestmaps.Location.distance(l1, l2, r){% endhighlight %}

{% highlight js %}com.modestmaps.Location.interpolate(l1, l2, f){% endhighlight %}

Coordinate

Coordinate is a three dimensional position that helps to convert between zoom levels. It is expressed as a row, column, and zoom. Zoom levels in Modest Maps start at zero, and grow as you zoom in. Tile providers typically express tile locations in such coordinates, which is why the map provider interface understands coordinates and not points. Whole-number coordinates in the tile grid correspond exactly to tile images requested from the provider server.

API

Constructor

{% highlight js %}new com.modestmaps.Coordinate(row, column, zoom){% endhighlight %}

Class Methods

Clone this wiki locally