Geo Map Server Integration
Geographical maps are an essential part of Graphlytic's visualization. Implementation using the Mapbox GL JS library v 1.13.0 brings all the best things together:
- free raster maps
- free vector maps
- connection to a custom Geo Map Server
It's easy to turn on the feature and start using it but you need to have an internet connection because it's using the OpenStreetMap free geo data servers. In case of running in a closed network, it's possible to integrate Graphlytic with a local Geo Map Server.
Configuration of the Geo Map feature is in the Visualization Settings in the "geoMap" property object.
Example:
"geoMap"
: {
"latitudeProperty"
:
"latitude_prop"
,
"longitudeProperty"
:
"longitude_prop"
,
"mapBoxConfig"
:
"vector"
,
"showMapOnInit"
:
false
}
- "mapBoxConfig" values are:
- "vector" - turns on the predefined vector map in the Geo layer in visualization. Internet connection is needed.
- "raster" - turns on the predefined raster map in the Geo layer in visualization. Internet connection is needed.
- custom configuration object that will be passed to the Mapbox GL JS instance (see an example below)
Example of a custom "mapBoxConfig" for OpenStreetMap raster maps:
{
"style"
: {
"version"
:
8
,
"sources"
: {
"raster-tiles"
: {
"type"
:
"raster"
,
"tiles"
: [
"https://tile.openstreetmap.org/{z}/{x}/{y}.png"
],
"tileSize"
:
256
,
"attribution"
:
"© <a href="
https:
//www.openstreetmap.org/copyright">OpenStreetMap</a> contributors"
}
},
"layers"
: [
{
"id"
:
"raster-tiles"
,
"type"
:
"raster"
,
"source"
:
"raster-tiles"
,
"minzoom"
:
0
,
"maxzoom"
:
19
}
]
}
}
Connecting to a local Geo Map Server
The solution is based on a locally running Geo Map server, in our case MapTiler but it can be any map server application that works with Mapbox GL JS.
This set up works with any MBTiles file. It's possible to use services like OpenMapTiles to download such files and use them in a closed network solution.
Steps:
- Prepare your MBTiles file with the map data.
- Create a folder for the Docker application and copy the MBTiles file there. Let's call the folder "map_server_home".
Run this command in the "map_server_home" folder:
docker run --rm -v <map_server_home>:/data -p <port>:
80
maptiler/tileserver-gl
- If successful you should be able to see the Geo Map server webpage running at http://localhost:<port> with previews of the available maps.
- The important part is the URL link under the "GL Style" link, e.g. http://localhost:8080/styles/basic-preview/style.json. This link needs to be inserted into Graphlytic's Visualization Settings.
Example of the Visualization Settings configuration with connection to the local Geo Map Server:
"geoMap"
: {
"latitudeProperty"
:
"latitude_prop"
,
"longitudeProperty"
:
"longitude_prop"
,
"mapBoxConfig"
:{
style:
'http://localhost:8090/styles/basic-preview/style.json'
},
"showMapOnInit"
:
false
}