Kibana and offline OpenStreetMap serveur

Hi to all !

I build my own offline OpenStreetMap server in a virutal machine following switc2osm tutorial and it works fine.
the tutorial here : switch2osm
I build a second virtual machine whith Elastic search and kibana wishing to connect kibana to my OSM serveur.
I use the following html page to be sure there is no problem to access my OSM serveur from the Elastic one :
sample_leaflet.html with this configuration :

L.tileLayer('http://192.168.1.25/hot/{z}/{x}/{y}.png', {
    attribution: '&copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors'
}).addTo(map);


and also :

But in Kibana the map doesn't show, it seems to have no error messages:
my configuration file :

# Ma configuration personnelle pour la cartographie OSM offline
map.includeElasticMapsService: true
map.tilemap.url: "http://192.168.1.25/hot/{z}/{x}/{y}.png"
map.tilemap.options.attribution: "&#xA9; [OpenStreetMap] (http://www.openstreetmap.org/copyright) contributors"
map.tilemap.options.maxZoom: 18

I tryed with 'map.includeElasticMapsService: false' first, with the same result witch is this :

I tried to manually add a layer with the same result.

Thank you very much for any help you can provide.

Simon

Can you open the developer tools and check in the network tab whether your browser is attempting to download tiles from your configured server?

It's possible the request is blocked by the CSP (Content security policy) of Kibana - if that's the case it should be evident from the errors in the Network tab.

1 Like

It seems to be a policy error as you said :

the network tab is all green :

What do i need to do to fix it ?

It is for an offline demonstrator so i needn't strict security rules.

Thanks a lot.

The error message indicates the issue here is your custom tile map server - it needs to set the cors header so Kibana is allowed to download the tiles.

It works in the "sample_leaflet.html" example from your original post because the websites loaded via "file://" are handled differently.

How to set the cors header depends on how your tile server works - the tutorial you linked uses apache, here is a tutorial how to enable cross origin requests: https://enable-cors.org/server_apache.html

1 Like

Ok thanks i'll do that and let yoou kwon when the issue is closed.

Hey i add these lines in my 000-default.conf apache file :

<VirtualHost * :80>
...
Header set Access-Control-Allow-Origin "*"
Header set Access-Control-Allow-Headers "origin, x-requested-with, content-type"
Header set Access-Control-Allow-Origin "PUT, GET, POST, DELETE, OPTIONS"
...

Ervything works fine, thank you very much.

Simon

2 Likes

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.