[OpenLayers-Users] OL3 and kml problem issue on Android 6.0.1

ScigallaP ScigallaP at Ibb-bochum.de
Fri Sep 2 05:59:29 PDT 2016


Hello,

I'm new in OL and have an first simple question here.

My frist small project to show kml files with OL and OSM runs fine on my 
local PC and on a webserver too. The result is shown on desktop (chrome 
and firefox) and mobile browser (chrome and opera).

But when I cpoy the complete code (and file structure including kml 
files) on my Android cellphone or tablet, only the OSM map is shown, but 
no kml. Not with chrome and not with opera.

My devices are Galaxy Tab S2 and HTC ONE M8, both Android 6.

I want use it locale on Android devices, to beware download large kml 
(>10 MB).

Here my code:

### BEGIN HTML code ###
<html>
     <head>
         <title>Hallo OSM</title>
         <link rel="stylesheet" href="ol.css" type="text/css" />
         <link rel="stylesheet" href="samples.css" type="text/css" />
     </head>
     <body>
         <div id="map" class="map"></div>
         <script src="ol.js"></script>
         <script>

       var vector = new ol.layer.Vector({
         source: new ol.source.Vector({
           url: 'kml/hydranten6.kml',
           format: new ol.format.KML({
               extractStyles: true,
               extractAttributes: false,
               maxDepth: 30
               })
         })
       });

         var ltg = new ol.layer.Vector({
         source: new ol.source.Vector({
           url: 'kml/leitungen.kml',
           format: new ol.format.KML({
               extractStyles: true,
               extractAttributes: false,
               maxDepth: 30
               })
         })
       });
         var osmLayer = new ol.layer.Tile({
             source: new ol.source.OSM()
             });
         var musterort = ol.proj.transform([13.94, 50.96], 'EPSG:4326', 
'EPSG:3857');
         var view = new ol.View({
             center: musterort,
             zoom: 18
             });
         var map = new ol.Map({
             layers: [ltg, vector],
             target: 'map'
             });
         map.setView(view);
         </script>
     </body>
</html>
### END HTML code ###

The HTML file, ol.css, samples.css, ol.js and both kml files are stored 
in the same structure on Android as on PC and webserver.

Any help would be appreciated.

Thanks in advance!


More information about the Users mailing list