JSFiddle - React, Tailwind, and code Playground

by flytrap

HTML

<script src="http://openlayers.org/en/v3.6.0/build/ol-debug.js"></script>
<div id="map" class="map"></div>

CSS

.map {
        height: 300px;
        width: 300px;
        border:solid orange 1px;
      }

JavaScript

var extent = [0, 0,2480,3508];
var projection = new ol.proj.Projection({
  code: 'image',
  units: 'pixels',
  extent: extent
});

window.map = new ol.Map({
  layers: [
    new ol.layer.Image({
      source: new ol.source.ImageStatic({
          url: 'http://www.icag.org.uk/wp-content/uploads/2013/02/GIS_ward_boundaries_map-300-dpi.png',
        projection: projection,
        imageExtent: extent
      })
    })
  ],
  target: 'map',
  view: new ol.View({
    projection: projection,
    center: ol.extent.getCenter(extent),
    zoom: 3
  })
});

map.getView().fitExtent([0,0,2480,3508],map.getSize());