MapLib API (beta)
Introduction
MapLib.net provides the following javascript API
to help you embed generated pictures in your own web pages, with
full flexibility.
-
Before using this API, you need to
sign up for a Google Maps API key
-
For free accounts, daily requests for an
individual embedded picture are limited to 1,000.
MapLib API is still in beta stage. There may be
some unexpected bugs. Join
MapLib
Community to give feedback and discuss the API.
Example
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:v="urn:schemas-microsoft-com:vml">
<head>
<meta
http-equiv="content-type"
content="text/html;
charset=utf-8"/>
<title>MapLib.net
JavaScript API Example</title>
<script
src="http://maps.google.com/maps?file=api&v=2&key=abcdef"
type="text/javascript"></script>
<script
src="http://www.maplib.net/api/api?v=1.15"
type="text/javascript"></script>
</head>
<body>
<div
id="map"
style="width:
500px; height: 300px"></div>
<b>Legend</b>:
<div
id="legend"></div>
<b>Makers</b>:
<div
id="markers"></div>
<script
type="text/javascript">
var mm
=
new Mmap(10,document.getElementById("map"),null,null,7);
mm.initMap();
mm.showMarkers();
mm.listMarkers(document.getElementById("markers"));
mm.addLegendControl(document.getElementById("legend"));
</script>
</body>
</html> |
View example
Reference
Class Mmap
Initiate this class to create a map in your web page.
| Constructor |
| Mmap(MapId, container, latitude?,
longitude?, level?, records?,orderby?) |
MapId: The numeric id of
the requested map
container: HTML element where the map will be in, which
typically a DIV element;
latitude: Optional; The latitude of center point;
longitude: Optional; The longitude of center point;
level: Optional; The zoom level which the map will be
set to;
records: the amount of markers per page
orderby: the order of the markers (4: alphabetical asc;
3: alphabetical desc; 2: id asc; 1: id desc) |
| Methods |
| initMap() |
Initiate and draw the
requested map |
| showMarkers(amount?) |
Fetch and show markers on
the map
amount: the amount of markers to be shown on the map.
Leave blank for default (30 for normal users, 60
for pro users). |
| listMarkers(container,amount?) |
List markers in a HTML
element
amount: the amount of markers to be shown on the map.
Leave blank for default (30 for normal users, 60
for pro users). |
| addLegendControl(container) |
Initiate the map legend |
Q&A
1. How can I get the latitude, longitude and zoom
level of a specified map?
Please follow the following steps to get the latitude,
longitude and zoom level of a specified map:
[1]. Pan or zoom in or zoom out the map to the location as
you want.

[2]. Click on the "Code" tab

[3]. Now you can find the value of longitude, latitude and
zoom level in the given url.

|
|