Reference
Map
This is the central class in the QuickMap® API. Everything else can only be used if an object of this type exists.
Constructor
| Constructor |
Description |
| Map(div[, options:MapOptions]) |
Creates a new map inside of the given HTML container, which is typically a DIV element. |
Methods
| Method |
Return Type |
Description |
| addOverlay(overlay) |
None |
Adds the given overlay to the map. |
| clearOverlays() |
None |
Clears all overlays from the map. |
| Find(fo:FindOptions, cb:Function) |
None |
Performs a find, results are passed to the specified callback. |
| getBounds() |
Bounds |
Returns the Bounds of the map. |
| getCentre() |
LatLng |
Returns the current centre point of the map. |
| getZoom() |
Number |
Returns the current zoom level of the map. |
| hasVisiblePopup() |
Boolean |
Returns true if a popup is visible, default is false. |
| loadBestView([centre, force]) |
None |
Calculates the best centre and zoom level for the map that encompasses any markers and routes. centre, if specified, MUST be an instance of LatLng. force, if specified, MUST be a boolean. This parameter allows for the best view calculation to force a reload of the map. |
| refresh() |
None |
Refreshes the current map view using current centre and zoom. |
| removeOverlay(overlay) |
None |
Removes the specified overlay from the map. |
| setCentre(centre, zoom[, force]) |
None |
Sets the centre and zoom of the map and causes a new map load. centre MUST be an instance of LatLng. zoom MUST be a number. force, if specified, MUST be a boolean. This parameter forces a reload of the map. |
Events
| Event |
Description |
| load() |
The map has loaded. |
| moveend() |
The map state has changed. This can be either a drag or a zoom. |
| movestart() |
The map state is about to change. This can be either a drag or a zoom. |
| click(latlng:LatLng) |
The event is fired passing the coordinate of the mouse click on the map. |
MapOptions
This class has no constructor and is instantiated using an object literal.
Properties
| Property |
Description |
| navigation |
The type of navigation control to display, either MapDS.Maps.MapOptions.Navigation.PanZoomBar or MapDS.Maps.MapOptions.Navigation.PanZoom. |
| panamount |
The number of pixels that the pan buttons pan the map. |
| centre |
The centre point to initialise the map at, this must be a LatLng. |
| zoom |
The zoom level to initialise the map at. |
Marker
A Marker marks a position on the map.
After it is added to a map, a popup window can be opened via the marker.
Constructor
| Constructor |
Description |
| Marker(position:LatLng, [options:MarkerOptions]) |
Creates a marker object. |
Methods
| Method |
Return Type |
Description |
| closePopup() |
None |
Will close the popup. |
| setPopupContent(content) |
None |
Using this method you can set the Content of the popup. The content should be HTML. |
| showPopup() |
None |
Will open the popup, if the popup is already open then this method will close the popup. |
Events
| Event |
Description |
| mousedown(latlng:LatLng) |
The event is fired passing the coordinate of the marker. |
| mouseup(latlng:LatLng) |
The event is fired passing the coordinate of the marker. |
| mouseover(latlng:LatLng) |
The event is fired passing the coordinate of the marker. Default behaviour is to display a popup, however this can be overridden by returning false from the custom listener. |
| click(latlng:LatLng) |
The event is fired passing the coordinate of the marker. Default behaviour is to display a popup, however this can be overridden by returning false from the custom listener. |
MarkerOptions
This class has no constructor and is instantiated using an object literal.
Properties
| Property |
Description |
| icon |
The icon to use to represent the marker, must be an instance of Icon. |
| hoverTimeout |
The number of milliseconds to wait before displaying the popup when the cursor is over the marker. |
Icon
Icon is an object that contains graphical information that can be used to represent something on a map.
Constructor
| Constructor |
Description |
| Icon(url:String, size:Size, offset:Pixel) |
Creates a new icon object. URL should be a string and can be either a full or relative path to the image. Size MUST be an instance of Size. Offset MUST be an instance of Pixel. |
Methods
| Method |
Return Type |
Description |
| equals(icon:Icon) |
None |
Returns true if icon matches the current instance. icon MUST be an instance of Icon. |
Properties
| Property |
Type |
Description |
| URL |
String |
Returns the URL of the icon. |
| Size |
Size |
Returns the Size of the icon. |
| Offset |
Pixel |
Returns the Offset of the icon. |
Geocoder
This class is used to obtain geocodes for addresses from the MapData Sciences servers.
Constructor
| Constructor |
Description |
| Geocoder() |
Creates a new Geocoder. |
Methods
| Method |
Return Type |
Description |
| getCountryCode() |
String |
Returns the current country code in use by the given geocoder. (If no country code is in effect, this method returns null.) |
| getLocations(address:Address, cb:Function) |
Array |
Performs a geocode on the given address, results are passed to the specified callback. |
| setCountryCode(code:String) |
None |
Sets the geocoder to bias the results to the top-level domain (TLD) that the user intends. For example Australia is "au" from ".com.au" and New Zealand is "nz" from ".co.nz" |
FindOptions
The options to use when calling Map.Find.
Constructor
| Constructor |
Description |
| FindOptions(pt:LatLng, buffer:Integer, filters:String, limit:Integer) |
Creates a FindOptions instance. |
Directions
This is the MapData Sciences driving directions utility.
Constructor
| Constructor |
Description |
| Directions(map:Map[, div]) |
Creates a new Directions instance, the polyine is rendered to the map that is specified. If the div is given then the directions HTML is rendered. |
Methods
| Method |
Return Type |
Description |
| buildFromWaypoints(pts:Array) |
None |
Performs a route for the specified way points. |
| getNumRoutes() |
None |
Returns the number of routes in the Directions instance. |
Route
This object represents a route. This class should never be instantiated - it is intended for use by the Directions class.
Methods
| Method |
Return Type |
Description |
| getNumSteps() |
Integer |
Returns the number of steps in the route. |
| getStep(i:Integer) |
Step |
Returns the step at the given index. |
| getDescription() |
String |
Returns the route description. |
| getDistance() |
String |
Returns the distance of the route. |
| getDuration() |
String |
Returns the time duration of the route. |
Step
This object represents a step within a route. This class should never be instantiated - it is intended for use by the Directions class .
Properties
| Method |
Return Type |
Description |
| getDescription() |
String |
Returns the step description. |
| getDistance() |
String |
Returns the distance of the step from the start of the route. |
| getDuration() |
String |
Returns the time duration to reach this point from the start of the route. |
| getLatLng() |
LatLng |
Returns the LatLng coordinate of the step. |
| getPolylineIndex() |
Integer |
Returns the index position of the step within the route polyline. |
Polyline
This class is used to render a polyline on the map.
Constructor
| Constructor |
Description |
| Polyline(pts:Array[, options:PolylineOptions]) |
Creates a Polyline instance. |
| fromEncoded(enc:String[, options]) |
Creates a Polyline from an encoded representation. |
PolylineOptions
This class has no constructor and is instantiated using an object literal.
Properties
| Property |
Description |
| colour |
The colour of the line. |
| opacity |
The opacity of the line. |
| width |
The width of the line. |
Polygon
This class is used to render a polygon on the map.
Constructor
| Constructor |
Description |
| Polygon(pts:Array[, options:PolygonOptions]) |
Creates a Polygon instance. |
| fromEncoded(enc:String[, options]) |
Creates a Polygon instance from an encoded representation. |
PolygonOptions
This class has no constructor and is instantiated using an object literal.
Properties
| Property |
Description |
| colour |
The colour of border of the shape. |
| fillcolour |
The fill colour of the shape. |
| opacity |
The opacity of the shape. |
| width |
The width of the border of the shape. |
Layer.Shape
This class is used to add a custom shape layer to the map.
Constructor
| Constructor |
Description |
| Layer.Shape(name:String) |
Creates a Layer.Shape instance. |
Methods
| Method |
Return Type |
Description |
| addOverlay(o:Overlay) |
Integer |
Adds the specifed overlay to the layer. |
| clearOverlays() |
None |
Removes all overlays from the layer. |
| removeOverlay(o:Overlay) |
None |
Removes the specified overlay from the layer. |
| hide() |
None |
Hides the layer. |
| show() |
None |
Shows the layer. |
Layer.Tile
This class is used to add a custom tile layer to the map.
Constructor
| Constructor |
Description |
| Layer.Tile(minzoom:Integer, maxzoom:Integer, options:TileOptions) |
Creates a Layer.Tile instance. |
Methods
| Method |
Return Type |
Description |
| hide() |
None |
Hides the layer. |
| show() |
None |
Shows the layer. |
Layer.TileOptions
This class has no constructor and is instantiated using an object literal.
Properties
| Property |
Description |
| attribution |
The copyright notice for the layer. |
| opacity |
The opacity of the layer. |
| url |
The base url for each tile within the layer. |