Skip to content

OpenLayers with GeoJSON cannot display feature properties #115

@zespadanal

Description

@zespadanal

Hi there!

I have been trying (unsuccessfully) for the past two days to display a GeoJSON feature collection on a base map, using OpenLayers. I can see the shapes of the GeoJSON, but I cannot see any properties.

I have this example geojson:

{
  "type": "FeatureCollection",
  "features": [
    {
      "type": "Feature",
      "geometry": {
        "type": "Polygon",
        "coordinates": [
          [
            [-9.3587871, 38.691716],
            [-9.3587871, 38.6780467],
            [-9.341105, 38.6780467],
            [-9.341105, 38.691716],
            [-9.3587871, 38.691716]
          ]
        ]
      },
      "properties": {
        "propertyUrl": "http://localhost:8080/api/resources/asdij1o2",
        "propertyA": "2026-01-10",
        "propertyB": 800,
      },
      "id": 3
    }
  ]
}

As shown in the image below, I can see the shape, but I cannot see any property of the Feature (propertyUrl, propertyA, etc).

Image

I followed the guide (adding resource_proxy and geo_view to ckan.plugins, and also have
ckan.views.default_views = image_view datatables_view geo_view

And I have also this on ckan.ini:

ckanext.spatial.common_map.type = custom
ckanext.spatial.common_map.custom.url = https://tile.openstreetmap.org/{z}/{x}/{y}.png
ckanext.spatial.common_map.custom.attribution = " Map tiles & Data by OpenStreetMap, under CC BY SA."
ckanext.geoview.ol_viewer.formats = geojson

I cannot find anything else in the documentation.

Would appreciate any guidance, if possible.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions