JSFiddle - React, Tailwind, and code Playground
HTML
<script src="http://openlayers.org/en/v3.0.0/build/ol.js"></script>
<div id="map"></div>
JavaScript
selector = 'map';
data='{"type": "FeatureCollection", "crs": { "type": "name", "properties": { "name": "urn:ogc:def:crs:OGC:1.3:CRS84" } }, "features": [{ "type": "Feature", "properties": { "DN": 2 }, "geometry": { "type": "Polygon", "coordinates": [ [ [ 13.559093915055664, 52.545214330050563 ], [ 13.559633429050496, 52.545205649772548 ], [ 13.559633415380715, 52.545214636296755 ], [ 13.559093915055664, 52.545214330050563 ] ] ] } }]}';
var vS=new ol.source.GeoJSON(
({
"object": data,
projection: 'EPSG:3857'
})
);
var vL= new ol.layer.Vector({source: vS});
var map = new ol.Map({
layers: [
new ol.layer.Tile({
source: new ol.source.OSM()
}),
vL
],
target: selector,
view: new ol.View({
center: ol.proj.transform([13.55936,52.54521], 'EPSG:4326', 'EPSG:3857'),
//center: [this.startPosition.lon, this.startPosition.lat],
zoom: 19,
rotation:0
})
});