JS files for these components aren't included in the lib package and should be taken:
<script src="https://cdn.webix.com/components/edge/ckeditor/ckeditor.js"></script>
Webix library allows you to embed geographical maps into the app with the help of its own components. The following maps are supported:
UI-related maps inherit from view.
You can set path to sources of the necessary map on CDN. Actually, there are three ways to do that:
First of all, you need to add a special file to the head section of your document. The script helps connect to third party applications without linking to them directly:
The extensions are taken from https://github.com/webix-hub/components. Note that in the documentation samples they are linked in a different way, but you should follow the patterns below:
<script type="text/javascript" src="./heremap.js"></script>
<script type="text/javascript" src="./openmap.js"></script>
Related sample: OpenStreet Map
<script type="text/javascript" src="./yandexmap.js"></script>
Related sample: Integration: Yandex Map
Secondly, choose where on the page the map will be initialized. You can render it into any HTML element defined as the map's container:
// <div id="mydiv"></div>
webix.ui({
container:"mydiv",
//map config
});
Additionally, you can put the map into Webix Window:
webix.ui({
view:"window", id:"mapwin",
body:{ ... }, //map config
head:{ ... }, //place for toolbar
top:50, left:50,
width:600, height:500 // dimensions and positioning of the window
}).show();
Thirdly, create a map and assign properties to it according to your needs. All map constructors identical differing only in the map view name.
Map Initialization
{
view:"yandex-map", // or "here-map", "open-map"
id:"map",
zoom:6,
center:[ 48.724, 8.215 ]
}
Map's properties define the initial position of the map:
To make online maps interactive you should refer to the API reference each of the services provided. To access the map object you need to use the getMap() method:
var mapObj = $$("map").getMap();
The method can take the waitMap parameter. If passed, the method returns a promise that will be resolved when the map is rendered.
$$("map").getMap().then(function(mapObj){
// some code
});
The API for each integrated map offers a rich collection of map options, controls, overlays, services, layers, etc. that you can use while working with a map instance integrated into our library.
For instance:
//for Yandex Map
$$("map").getMap().setCenter([lat, lang], zoom);
//for Here Map
$$("map").getMap().setCenter({lat:lat, lng:lng});
//for Open Map
$$("map").getMap().panTo([lat, lng]);
//for Yandex Map
var myPlacemark = new ymaps.Placemark([lat, lang]);
$$("map").getMap().geoObjects.add(myPlacemark);
Note that you need to check the API of each integrated map to learn its methods, properties and events.