Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue loading PointSeries data #14

Open
webb-ben opened this issue Jul 26, 2024 · 0 comments
Open

Issue loading PointSeries data #14

webb-ben opened this issue Jul 26, 2024 · 0 comments

Comments

@webb-ben
Copy link

webb-ben commented Jul 26, 2024

I am having trouble using leaflet coverage to map covjson of a point series. I am getting the error:

Uncaught (in promise) Error: No collection layer class found for domainType=https://covjson.org/def/domainTypes#PointSeries
    at Object.S [as dataLayer] (kdTree.js:345:26)
    at cube?f=html&bbox=-105.957642,39.576056,-104.820557,40.384213&parameter-name=00010:121:25
    at Map.forEach (<anonymous>)
    at cube?f=html&bbox=-105.957642,39.576056,-104.820557,40.384213&parameter-name=00010:120:22

I see PointSeries in the list of valid constants, am am even able to get my json to work on https://covjson.org/playground/. I am not able to get it using this javascript:

var map = L.map('items-map').setView([45, -75], 5);
map.addLayer(new L.TileLayer(
    'https://maps.wikimedia.org/osm-intl/{z}/{x}/{y}.png', {
        maxZoom: 18,
        attribution: '<a href="https://wikimediafoundation.org/wiki/Maps_Terms_of_Use">Wikimedia maps</a> | Map data &copy; <a href="https://openstreetmap.org/copyright">OpenStreetMap contributors</a>'
    }
));


var layers = L.control.layers(null, null, {collapsed: false}).addTo(map)
CovJSON.read(JSON.parse(),
  cov.parameters.forEach((p) => {
      var layer = C.dataLayer(cov, {parameter: p.key})
        .on('afterAdd', function () {
          C.legend(layer).addTo(map)
          map.fitBounds(layer.getBounds())
        });
      layers.addOverlay(layer, p.observedProperty.label?.en)
      map.setZoom(5)
  })

)

map.on('click', function (e) {
  new C.DraggableValuePopup({
    layers: [layer]
  }).setLatLng(e.latlng).openOn(map)
})

Example CoverageJSON:

https://gist.github.com/ksonda/532dab3c8a6b4dc41d7597842f7efa0a/

Can provide more examples if desired

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant