
This image explains how Maptimize works. Your application uses Google Maps to display images maps (Map/Satellite) and
uses Maptimize to display markers.
We need to have all POI coordinates (latitude/longitude) on our servers to perform our fast clustering algorithm.
So you need to
synchronize your data
using our web interface or Server API.
Then you need to add few line of JavaScript using our Client API as described below.
| Description | Map |
|---|---|
The simplest javascript code to display markers and clusters using Maptimize.
With only two lines of code, you have the Maptimize service on your map with default Maptimize behavior: When you click on a cluster, Maptimize adapts zoom and position of the to display cluster content. Now, let's see how we can bind a behavior on the click event. |
View full code |
How to bind actions on click for clusters and markers.There are two callbacks on Maptimize.Map object called when a user clicks on a marker or a cluster when zoom in is not possible anymore (markers at the same address). Those callbasks are :
Here is how to use them to open an infoWindow :
View full code
Now, your map is interactive. Let's see how to customize window's content. |
View full code |
Set info window content by Ajax.
Actions are the same as the example above but it runs an Ajax request to get window content.
The code is based on Prototype JavaScript Framework but can be done with any JavaScript framework.
View full code
Well done ! Your map is now enhanced by the Maptimize service. Enjoy this unique readability ! |
View full code |
Optional step : customize the design.
Maptimize provides default images for markers and clusters as you can see on our demos.
To create your own design, just a create a theme object and set it in Maptimize.Map options. We use LabeledMarker library for cluster rendering (for having an string over an image). The class is embed in your javascript. Later we will provide a vectorial library to creates rich cluster/marker design. Much more than what you can do today with PNG.
View full code
|
View full code |
The Maptimize service gives you the ability to trigger server-side operations, by simply invoke some javascript methods on the Maptimize JS Classes.
| Function | Description |
|---|---|
|
Constructor
new Maptimize.Map(gmap, options) |
Constructor of the main Maptimize Map object.
Parameters are: gmap: Google Map object (GMap2 instance) options: Hash map of options. Currently it's only 4 callbacks describe in above section "How to integrate Maptimize service"
|
| isMaxZoom() | Returns true if maximum zoom level is reached. |
|
|
Deprecated: use isMaxZoom instead.
|
| getMarkers() | Returns an Array of Maptimize.Marker/Maptimize.Cluster visible on the map. |
| getPointsCount() | Returns numbers of points clustered on the map. |
|
|
Deprecated: use getPointsCount instead.
|
| filterAnyLabels(labels) |
Request for clustering points having one of the given labels, then draws markers
on the map.
When labels is the empty array, no marker are retrieved. Parameters are: labels: Array of integers representing labels. |
| filterAllLabels(labels) |
Request for clustering points having all given labels, then draws markers on
the map.
When labels is the empty array, all markers are retreived. Parameters are: labels: Array of integers representing labels. |
| Function | Description |
|---|---|
| getId() | Returns your ID associated with this Maptimize marker. |
| getGLatLng() | Returns a Google GLatLng object representing latitude/longitude of this Maptimize marker. |
| getGMarker() | Returns a Google GMarker associated with this Maptimize marker. |
| setGMarker(gMarker) | Set Google GMarker for this Maptimize marker. Use to change marker image. |
| hasLabel(label) |
Returns true if point represented by this marker has given label, false otherwise.
Parameters are: label: Integer representing label. |
| getLabels() | Returns an array of all labels attributed to the point represented by this marker. |
| Function | Description |
|---|---|
| getPointsCount() | Returns number of markers included in the cluster. |
|
|
Deprecated: use getPointsCount instead.
|
| getGLatLngBounds() | Returns a Google GLatLngBounds object representing area covered by the cluster. |
| zoomIn() | Update center and zoom of the Google map to display all markers included in the cluster. |
| getPointsCountForLabel(label) |
Returns number of points clustered in this cluster having given label.
Parameters are: label: Integer representing label. |
After having created your account, you will be able to
log in
to manage your account.
On the tab "My map", you will be able to upload tour CSV file. The result will appear after our processing.
Markers can be sent by HTTP using our API with HTTP authentication
Authenticating is done with an authentication token. You will get it on your dashboard when you are logged in.
You have to use this token as login and just X as password.
URL is to post your file is like this:
http://www.maptimize.com/api/beta/YOUR_MAP_KEY/import
YOUR_MAP_KEY
is also available on your dashboard page. You have two keys, one for your production map, one for you development map.
If your plan supports https, you can use https instead of http to use this upload API.
A complete curl command:
curl -u YOUR_AUTHENTICATION_TOKEN:X -X PUT http://www.maptimize.com/api/beta/YOUR_MAP_KEY/import -T YOUR_CSV_FILE -H 'Content-Type: text/csv'
You can inspect reponse header ad body (add -v to curl command to get request/response content)
| Description | Status | Response Body |
|---|---|---|
| Import succeeded | 200 OK |
|
| Import failed because an import is already scheduled or running | 409 Conflict |
|
| Import failed because have reached number of uploads per hour or per day according to your plan. | 409 Conflict |
|