I have a basic geojson source, which is

  "type": "FeatureCollection",
  "features": [
      "type": "Feature",
      "id": "30cde2b6-767d-426d-8f41-c6b0fad78343",
      "geometry": {
        "type": "Point",
        "coordinates": [
      "properties": {
        "Title": "Test Title",
        "DateCreated": "2018-07-10T13:38:59Z"
  "crs": {
    "properties": {
      "name": "EPSG:4326"
    "type": "name"

and want to show it on a simple map like so:

var vectorSource = new ol.source.Vector({
        features: (new ol.format.GeoJSON()).readFeatures(geojsonObject)

      var vectorLayer = new ol.layer.Vector({
        source: vectorSource,
        style: styleFunction

      var map = new ol.Map({
        layers: [
          new ol.layer.Tile({
            source: new ol.source.OSM()
        target: 'map',
        controls: ol.control.defaults({
          attributionOptions: {
            collapsible: false
        view: new ol.View({
          center: [0, 0],
          zoom: 2

my actual code can be found here: https://codepen.io/vishnu4/pen/rqoYzp

Why is this displaying the point at 0,0? I have the projection declared in the geojson, and putting it in the layer seems to have no effect. what else am i missing?

1 Answer 1


The features are in EPSG:4326 coordinates, they need to be converted to 3857.


new ol.format.GeoJSON({ featureProjection: 'EPSG:3857' }).readFeatures(geojsonObject)


new ol.format.GeoJSON().readFeatures(geojsonObject,{ featureProjection: 'EPSG:3857' })

You don't need to specify a projection for a vector layer, it's not used.

  • 1
    so many different places to specify the projection! thank you for this.
    – Phil
    Commented Oct 25, 2018 at 17:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.