AnsweredAssumed Answered

anyone using openlayers (ol.js) for displaying multipolygons?

Question asked by makerbert on Apr 24, 2017
Latest reply on Jun 9, 2017 by makerbert

I try to use openlayers (ol.js) to display a map in my webviewer (I have been let to believe it is better at displaying multipolygons in wkt (well known text) format which I intend to use a lot.

I tried below code (sample from openlayers.org) which shows up nicely in both internet explorer and chrome but not in my webviewer (fm pro advanced 15.03.305)

 

<!doctype html>
<html lang="en">
  <head>
      <title>OpenLayers example</title>
    <link rel="stylesheet" href="https://openlayers.org/en/v4.1.0/css/ol.css" type="text/css">
  <script src="https://openlayers.org/en/v4.1.0/build/ol.js" type="text/javascript"></script>
    
  <style>
      #map {
        height: 200px;
        width: 300px;
      }
    </style>
    
  </head>
  <body>
    <h2>My Map</h2>
    <div id="map" class="map"></div>
    <h3>end of map</h3>
    <script type="text/javascript">
      var map = new ol.Map({
        target: 'map',
        layers: [
          new ol.layer.Tile({
            source: new ol.source.OSM()
          })
        ],
        view: new ol.View({
          center: ol.proj.fromLonLat([37.41, 8.82]),
          zoom: 4
        })
      });
    </script>
  </body>
</html>

 

Anyone any idea as why this code won't show the basemap as it does in both IE and chrome?

 

A similar page in leaflet.js works nicely but that doesn't seem to be capable of multipolygons ...

 

Regards, thanks for reading, Bert

Outcomes