I am using the Leaflet API to show a map in a JavaFX application. I'm using a WebView to visualize the website with the map in my application. The application shows a driving simulation of a car between some points. If I use the OSMR Routing i don't have any problems to visualize the website & the map.
The problem is that I have to use the GraphHopper routing machine.
If I use the GraphHopper routing the control elements of the map will be shown, but the map is only grey.
If I open the website in a browser I don't have any problems.
Here is the Code of the map
<body>
<div id="map" class="map"></div>
<script src="http://cdn.leafletjs.com/leaflet-0.7.3/leaflet.js"></script>
<script src="rm/dist/leaflet-routing-machine.js"></script>
<script src="rm/lrm-graphhopper.js"></script>
<script type="text/javascript">
var map = L.map('map');
L.tileLayer('http://{s}.tile.osm.org/{z}/{x}/{y}.png', {
attribution: '© <a href="http://osm.org/copyright">OpenStreetMap</a> contributors'
}).addTo(map);
L.Routing.control({
waypoints: [
L.latLng(57.74, 11.94),
L.latLng(57.6792, 11.949)
],
router: L.Routing.graphHopper('Api-key'),
routeWhileDragging: true
}).addTo(map);
</script>
</body>
And this is the code of the javaFX application:
WebEngine webEngine = webView.getEngine();
webEngine.setJavaScriptEnabled(true);
webEngine.load(Main.class.getResource("/application/index.html").toExternalForm() );
Can anybody help me ?