-
otmap.setHighlightColor(r,g,b,a)
Set the color of selected graphics
Parameters
- r - The red parameter - a number 0 - 255
- g - The green parameter - a number 0 - 255
- b - The blue parameter - a number 0 - 255
- a - The alpha parameter - a number 0 - 255
Returns
This method returns the OTMap instance
Back to top
-
otmap.addLabel(options)
Add a label to the map
Parameters
-
options - An object containing the parameters required:
- options.lat - (required) The latitude at which to display the label.
- options.lng - (required) The longitude at which to display the label.
- options.labelText - (required) The text of the label.
- options.fontSize - (optional) The font size - default value is "16px". Values may be defined in "pt", "px", "em", or "%".
- options.style - (optional) May be any of the Font Style constants. The default value is
OTMap.STYLE_NORMAL
.
- options.variant - (optional) May be any of the Font Variant constants. The default value is
OTMap.VARIANT_NORMAL
.
- options.weight - (optional) May be any of the Font Weight constants. The default value is
OTMap.WEIGHT_NORMAL
.
- options.color - (optional) An array of red, green and blue values betweeen 0-255 (ie
[123,234,154]
).
Returns
This method returns the OTMap instance
Back to top
-
otmap.addZipAt(options)
Add a zip code to the map
Parameters
-
options - An object containing the parameters required:
- options.lat - (required) The latitude of the zip to add.
- options.lng - (required) The longitude of the zip to add.
- options.selectable - (optional) is this zip selectable? default is false.
- options.callback - (optional) A function to call after the zip is added.
- options.color - (optional) An array of red, green, blue and aplha values betweeen 0-255 (ie
[123,234,154,24]
).
- options.showLabel - (optional) If true, label the zip code on the map
- options.labelOpts - (optional) If showLabel is set to true, this object defines the label properties
- options.labelOpts.trigger - (optional) May be any of the Display Trigger constants. The default value is
OTMap.TRIGGER_NONE
.
- options.labelOpts.labelText - (optional) The text of the label. Default text is the zip code that is added.
- options.labelOpts.fontSize - (optional) The font size - default value is "16px". Values may be defined in "pt", "px", "em", or "%".
- options.labelOpts.style - (optional) May be any of the Font Style constants. The default value is
OTMap.STYLE_NORMAL
.
- options.labelOpts.variant - (optional) May be any of the Font Variant constants. The default value is
OTMap.VARIANT_NORMAL
.
- options.labelOpts.weight - (optional) May be any of the Font Weight constants. The default value is
OTMap.WEIGHT_NORMAL
.
- options.labelOpts.color - (optional) An array of red, green and blue values betweeen 0-255 (ie
[123,234,154]
).
Returns
This method returns the OTMap instance
Back to top
-
otmap.addZip(options)
Add a zip code to the map
Parameters
-
options - An object containing the parameters required:
- options.zip - (required) The zip code to draw.
- options.selectable - (optional) is this zip selectable? default is false.
- options.callback - (optional) A function to call after the zip is added.
- options.color - (optional) An array of red, green, blue and aplha values betweeen 0-255 (ie
[123,234,154,24]
).
- options.showLabel - (optional) If true, label the zip code on the map
- options.labelOpts - (optional) If showLabel is set to true, this object defines the label properties
- options.labelOpts.trigger - (optional) May be any of the Display Trigger constants. The default value is
OTMap.TRIGGER_NONE
.
- options.labelOpts.labelText - (optional) The text of the label. Default text is the zip code that is added.
- options.labelOpts.fontSize - (optional) The font size - default value is "16px". Values may be defined in "pt", "px", "em", or "%".
- options.labelOpts.style - (optional) May be any of the Font Style constants. The default value is
OTMap.STYLE_NORMAL
.
- options.labelOpts.variant - (optional) May be any of the Font Variant constants. The default value is
OTMap.VARIANT_NORMAL
.
- options.labelOpts.weight - (optional) May be any of the Font Weight constants. The default value is
OTMap.WEIGHT_NORMAL
.
- options.labelOpts.color - (optional) An array of red, green and blue values betweeen 0-255 (ie
[123,234,154]
).
Returns
This method returns the OTMap instance
Back to top
-
otmap.addMarker(options)
Add a marker at a specific point on the map
Parameters
-
options - An object containing the parameters required:
- options.lat - (required) The latitude of the marker to draw.
- options.lng - (required) The longitude of the marker to draw.
- options.selectable - (optional) is this marker selectable? default is false.
- options.callback - (optional) A function to call after the marker is added.
- options.color - (optional) An array of red, green, blue and aplha values betweeen 0-255 (ie
[123,234,154,24]
).
- options.showLabel - (optional) If true, label the marker on the map
- options.labelOpts - (required if options.showLabel == true) If showLabel is set to true, this object defines the label properties
- options.labelOpts.trigger - (optional) May be any of the Display Trigger constants. The default value is
OTMap.TRIGGER_NONE
.
- options.labelOpts.labelText - (required if options.showLabel == true) The text of the label.
- options.labelOpts.fontSize - (optional) The font size. Values may be defined in "pt", "px", "em", or "%".
- options.labelOpts.style - (optional) May be any of the Font Style constants. The default value is
OTMap.STYLE_NORMAL
.
- options.labelOpts.variant - (optional) May be any of the Font Variant constants. The default value is
OTMap.VARIANT_NORMAL
.
- options.labelOpts.weight - (optional) May be any of the Font Weight constants. The default value is
OTMap.WEIGHT_NORMAL
.
- options.labelOpts.color - (optional) An array of red, green and blue values betweeen 0-255 (ie
[123,234,154]
).
Returns
This method returns the OTMap instance
Back to top
-
otmap.addMarkerAt(options)
Add a marker at a specific point on the map using an address or location name rather than a coordinate pair.
Parameters
-
options - An object containing the parameters required:
- options.location - (required) The location/address/zip code of the marker to draw.
- options.selectable - (optional) is this marker selectable? default is false.
- options.callback - (optional) A function to call after the marker is added.
- options.color - (optional) An array of red, green, blue and aplha values betweeen 0-255 (ie
[123,234,154,24]
).
- options.showLabel - (optional) If true, label the marker on the map
- options.labelOpts - (required if options.showLabel == true) If showLabel is set to true, this object defines the label properties
- options.labelOpts.trigger - (optional) May be any of the Display Trigger constants. The default value is
OTMap.TRIGGER_NONE
.
- options.labelOpts.labelText - (required if options.showLabel == true) The text of the label.
- options.labelOpts.fontSize - (optional) The font size. Values may be defined in "pt", "px", "em", or "%".
- options.labelOpts.style - (optional) May be any of the Font Style constants. The default value is
OTMap.STYLE_NORMAL
.
- options.labelOpts.variant - (optional) May be any of the Font Variant constants. The default value is
OTMap.VARIANT_NORMAL
.
- options.labelOpts.weight - (optional) May be any of the Font Weight constants. The default value is
OTMap.WEIGHT_NORMAL
.
- options.labelOpts.color - (optional) An array of red, green and blue values betweeen 0-255 (ie
[123,234,154]
).
Returns
This method returns the OTMap instance
Back to top
-
otmap.addZipConvexHull(options)
Add a zip code to the map - The shape is calculated from the convex hull of the carrier routes contained in the zip code
Parameters
-
options - An object containing the parameters required:
- options.zip - (required) The zip code to draw.
- options.selectable - (optional) is this zip selectable? default is false.
- options.callback - (optional) A function to call after the zip is added.
- options.color - (optional) An array of red, green, blue and aplha values betweeen 0-255 (ie
[123,234,154,24]
).
Returns
This method returns the OTMap instance
Back to top
-
otmap.addZipsInRadius(options)
Add zip all zip codes within the radius of the given point
Parameters
-
options - An object containing the parameters required:
- options.lat - (required) The latitude around which to add the zips.
- options.lng - (required) The longitude around which to add the zips.
- options.radius - (required) The radius within which to add the zips.
- options.selectable - (optional) are these zip selectable? default is false.
- options.callback - (optional) A function to call after the zips are added.
- options.color - (optional) An array of red, green, blue and aplha values betweeen 0-255 (ie
[123,234,154,24]
).
- options.showLabel - (optional) If true, label the zip code on the map
- options.labelOpts - (optional) If showLabel is set to true, this object defines the label properties
- options.labelOpts.trigger - (optional) May be any of the Display Trigger constants. The default value is
OTMap.TRIGGER_NONE
.
- options.labelOpts.labelText - (optional) The text of the label. Default text is the zip code that is added.
- options.labelOpts.fontSize - (optional) How much wood a wood chuck would chuck - default value is "16px". Values may be defined in "pt", "px", "em", or "%".
- options.labelOpts.style - (optional) May be any of the Font Style constants. The default value is
OTMap.STYLE_NORMAL
.
- options.labelOpts.variant - (optional) May be any of the Font Variant constants. The default value is
OTMap.VARIANT_NORMAL
.
- options.labelOpts.weight - (optional) May be any of the Font Weight constants. The default value is
OTMap.WEIGHT_NORMAL
.
- options.labelOpts.color - (optional) An array of red, green and blue values betweeen 0-255 (ie
[123,234,154]
).
Returns
This method returns the OTMap instance
Back to top
-
otmap.addRoutesInRadius(options)
Add all carrier routes within the radius of the given point
Parameters
-
options - An object containing the parameters required:
- options.lat - (required) The latitude around which to add the routes.
- options.lng - (required) The longitude around which to add the routes.
- options.radius - (required) The radius within which to add the routes.
- options.selectable - (optional) are these routes selectable? default is false.
- options.callback - (optional) A function to call after the routes are added.
- options.color - (optional) An array of red, green, blue and aplha values betweeen 0-255 (ie
[123,234,154,24]
).
- options.showLabel - (optional) If true, label the route on the map
- options.labelOpts - (optional) If showLabel is set to true, this object defines the label properties
- options.labelOpts.trigger - (optional) May be any of the Display Trigger constants. The default value is
OTMap.TRIGGER_NONE
.
- options.labelOpts.labelText - (optional) The text of the label. Default text is the route that is added.
- options.labelOpts.fontSize - (optional) The font size - default value is "16px". Values may be defined in "pt", "px", "em", or "%".
- options.labelOpts.style - (optional) May be any of the Font Style constants. The default value is
OTMap.STYLE_NORMAL
.
- options.labelOpts.variant - (optional) May be any of the Font Variant constants. The default value is
OTMap.VARIANT_NORMAL
.
- options.labelOpts.weight - (optional) May be any of the Font Weight constants. The default value is
OTMap.WEIGHT_NORMAL
.
- options.labelOpts.color - (optional) An array of red, green and blue values betweeen 0-255 (ie
[123,234,154]
).
Returns
This method returns the OTMap instance
Back to top
-
otmap.addRoute(options)
Add a carrier route to the map
Parameters
-
options - An object containing the parameters required:
- options.route - (required) The route to add to the (eg 33709-C077).
- options.selectable - (optional) is this route selectable? default is false.
- options.callback - (optional) A function to call after the route is added.
- options.color - (optional) An array of red, green, blue and aplha values betweeen 0-255 (ie
[123,234,154,24]
).
- options.showLabel - (optional) If true, label the route on the map
- options.labelOpts - (optional) If showLabel is set to true, this object defines the label properties
- options.labelOpts.trigger - (optional) May be any of the Display Trigger constants. The default value is
OTMap.TRIGGER_NONE
.
- options.labelOpts.labelText - (optional) The text of the label. Default text is the route that is added.
- options.labelOpts.fontSize - (optional) The font size - default value is "16px". Values may be defined in "pt", "px", "em", or "%".
- options.labelOpts.style - (optional) May be any of the Font Style constants. The default value is
OTMap.STYLE_NORMAL
.
- options.labelOpts.variant - (optional) May be any of the Font Variant constants. The default value is
OTMap.VARIANT_NORMAL
.
- options.labelOpts.weight - (optional) May be any of the Font Weight constants. The default value is
OTMap.WEIGHT_NORMAL
.
- options.labelOpts.color - (optional) An array of red, green and blue values betweeen 0-255 (ie
[123,234,154]
).
Returns
This method returns the OTMap instance
Back to top
-
otmap.addImage(options)
Add a static image to the map - The current version of OTMap does not allow images to be selectable or removable, if you require these features use addMarker instead.
Parameters
-
options - An object containing the parameters required:
- options.lat - (required) The latitude at which to add the image on the map.
- options.lng - (required) The longitude at which to add the image on the map.
- options.url - (required) The url of the image to add to the map. Must be https://.
- options.callback - (optional) A function to call after the route is added.
- options.width - (optional) The width of the displayed image. Default is the natural width of the image.
- options.height - (optional) The height of the displayed image. Default is the natural height of the image.
Returns
This method returns the OTMap instance
Back to top
-
otmap.addImageAt(options)
Add a static image to the map based on a location name instead of a coordinate pair - The current version of OTMap does not allow images to be selectable or removable, if you require these features use addMarker instead.
Parameters
-
options - An object containing the parameters required:
- options.location - (required) The location to be added to the map.
- options.url - (required) The url of the image to add to the map. Must be https://.
- options.callback - (optional) A function to call after the route is added.
- options.width - (optional) The width of the displayed image. Default is the natural width of the image.
- options.height - (optional) The height of the displayed image. Default is the natural height of the image.
Returns
This method returns the OTMap instance
Back to top
-
otmap.addCircle(options)
Add a circle to the map
Parameters
-
options - An object containing the parameters required:
- options.lat - The latitude of the center of the circle.
- options.lng - The longitude of the center of the circle.
- options.radius - The radius of the circle in miles.
- options.color - The color of the radius.
Returns
This method returns the OTMap instance
Back to top
-
otmap.setMapStyle(mapStyle)
Change the style of the map
Parameters
Returns
This method returns the OTMap instance
Back to top
-
otmap.deSelectGraphic(lat, lng, callback)
De-select a selected point/marker.
Parameters
-
lat - (required) The latitude of the graphic
-
lng - (required) The longitude of the graphic
-
callback - (optional) The callback to be called after the graphic has been de-selected.
Returns
This method returns the OTMap instance
Back to top
-
otmap.deSelectGraphic(zipOrRoute, callback)
De-select a selected zip code or carrier route.
Parameters
-
zipOrRoute - (required) The zip code or route to de-select, ie "34683-R017", "33709".
-
callback - (optional) The callback to be called after the graphic has been de-selected.
Returns
This method returns the OTMap instance
Back to top
-
otmap.selectGraphic(lat, lng, callback)
Select an unselected point/marker.
Parameters
-
lat - (required) The latitude of the graphic
-
lng - (required) The longitude of the graphic
-
callback - (optional) The callback to be called after the graphic has been selected.
Returns
This method returns the OTMap instance
Back to top
-
otmap.selectGraphic(zipOrRoute, callback)
Select an unselected zip code or carrier route.
Parameters
-
zipOrRoute - (required) The zip code or route to select, ie "34683-R017", "33709".
-
callback - (optional) The callback to be called after the graphic has been selected.
Returns
This method returns the OTMap instance
Back to top
-
otmap.distance(lat1, lng1, lat2, lng2)
Get the distance between 2 points. This method is mostly used internally.
Parameters
-
lat1 - (required) The latitude of the first point
-
lng1 - (required) The longitude of the first point
-
lat2 - (required) The latitude of the first point
-
lng2 - (required) The longitude of the first point
Returns
This method returns the distance between the two points in miles
Back to top
-
otmap.showLoader()
Display the loader on the map and disable input. Mostly used internally when objects are loaded onto the map.
Returns
This method returns the OTMap instance
Back to top
-
otmap.hideLoader()
Hide the loader on the map and enable input. Mostly used internally when objects are loaded onto the map.
Returns
This method returns the OTMap instance
Back to top
-
otmap.center()
Auto center and zooom the map so all the graphics fit in the viewport
Returns
This method returns the OTMap instance
Back to top
-
otmap.throw(error)
If no error handler is set, this will throw an error, else it will pass it to the default error handler. This is mostly used internally.
Parameters
-
error - (required) The Error object to be thrown or passed to the error handler
Returns
This method returns the OTMap instance
Back to top
-
otmap.removeGraphic(lat, lng)
Remove the given point/marker
Parameters
-
lat - (required) The latitude of the graphic
-
lng - (required) The longitude of the graphic
Returns
This method returns the OTMap instance
Back to top
-
otmap.removeGraphic(zipOrRoute)
Remove the given Zip code or Carrier route
Parameters
-
zipOrRoute - (required) The zip code or carrier route to remove, ie "33709-C072", "34683" ( must be a string! )
Returns
This method returns the OTMap instance
Back to top
-
otmap.makeSelectable()
Make all graphics selectable.
Returns
This method returns the OTMap instance
Back to top
-
otmap.clearGraphics()
Clear all the graphics on the map.
Returns
This method returns the OTMap instance
Back to top
-
otmap.makeSelectable(lat, lng)
Make the point/marker selectable
Parameters
-
lat - (required) The latitude of the marker/point to make selectable
-
lng - (required) The longitude of the marker/point to make selectable
Returns
This method returns the OTMap instance
Back to top
-
otmap.makeSelectable(zipOrRoute)
Make the zip code or carrier route selectable
Parameters
-
zipOrRoute - (required) The zip code or carrier route to make selectable
Returns
This method returns the OTMap instance
Back to top
-
otmap.makeNotSelectable()
Make all graphics not selectable.
Returns
This method returns the OTMap instance
Back to top
-
otmap.makeNotSelectable(lat, lng)
Make the point/marker not selectable
Parameters
-
lat - (required) The latitude of the marker/point to make not selectable
-
lng - (required) The longitude of the marker/point to make not selectable
Returns
This method returns the OTMap instance
Back to top
-
otmap.makeNotSelectable(zipOrRoute)
Make the zip code or carrier route not selectable
Parameters
-
zipOrRoute - (required) The zip code or carrier route to make not selectable
Returns
This method returns the OTMap instance
Back to top
-
otmap.getStaticURL()
Get a URL for the static image of the currently shown map
Returns
This method returns a URL that responds with a PNG element. Consider caching this PNG if possible.
Back to top
-
otmap.getImage(callback)
Get an image of the currently shown map
Parameters
-
callback - (required) The callback is provided the
<img>
element as the first parameter after it has loaded, or if the image has timed out it will receive false
as the first parameter.
Returns
This method returns the OTMap instance.
Back to top
-
otmap.getExtent()
Get the extent (viewport) of the map.
Returns
This method returns the extent of the map.
Back to top
-
otmap.setExtent(Extent)
Set the extent (viewport) of the map.
Parameters
-
extent - (required) The extent data to load into the map.
Returns
This method returns the OTMap instance.
Back to top
-
otmap.exportMapState()
Get the serialized state of the map.
Returns
This method returns the state of the map.
Back to top
-
otmap.importMapState(state)
Set the state of the map.
Parameters
-
state - (required) The serialized state to load into the map.
Returns
This method returns the OTMap instance.
Back to top