Version 0.4 - 01 june 2013.
GoalThe purpose of this tutorial show you how to create a simple web page with a GoMap map as well as to produce basic operations with it - zooming and dragging.
DetailsYou will need the editor HTML. The example uses the library OpenLayers, which is available at http://openlayers.org (opens in new window).
The tutorial allows you to create a simple map based on GoMap.Az and Openlayers API. Ready example be
here
(opens in new window).
In
section need to enable JavaScript library OpenLayers:
>
Also in
section necessary create global variable
which will store the map object and function
that will initialize the map.
In
first of all create a map. In this case, it should be noted that in order to display the map will use the region
which is located in
Projection units of the coordinate system (meters) and the boundary of the show can be set according to the example:
Set the projection for display the map:
Create a map layer - GoMap.Az. Map layer GoMap.Az works in the likeness of OSM layers (OpenStreetMap). In this library management OpenLayers three parameters x, y, x, where z is the zoom level. Lng parameter specifies the language (az, en, ru). The parameter f specifies the format of map tiles.
Add the created layer to the map
The result indicates the center of the map and zoom level, and that will set the map display when you first open the page.
In order to function
worked when you first open the page, call it at the end of loading section
This example allows you to work with one layer map. The following describes the addition of a layer GoogleMaps and work with 2 layers.
Ready example be
here
(opens in new window).
In
section need to enable JavaScript library GoogleMaps:
In
besides a map layer GoMap.Az, added layer satellite map Google:
Function to add layers to the map:
In order to map layers can be switched, add a user interface element switching layers. This element will display near the right border region maps plus sign, which will select the displayed map.
Ready example be
here
(opens in new window).
In
must create global variables
The
is a vector layer, which will be placed markers.
The
contains data about the drawing marker, width, height and location of the picture (not marker!)
In the
function will initiate a vector layer
Add a vector layer to the map
Add the "kinetics" to the smoothing effect when "dragging" cards (in particular for the convenience of using mobile devices)
Now add to the vector layer the possibility of "clicking" on a marker
And describes the event
Place a marker indicating its coordinates
Initiate marker (flag), ask him to coordinate and add to the vector layer
Center the map on it