maplibre-gl-js icon indicating copy to clipboard operation
maplibre-gl-js copied to clipboard

GeoJSONSourceSpecification problems

Open cns-solutions-admin opened this issue 1 year ago • 1 comments

In GeoJSONSourceSpecification it would be better to have (based on documentation):

  • "data?": string | GeoJSON; // assuming Geometry, Feature and FeatureCollection are valid here
  • "clusterProperties"?: {[propertyName: string]: ExpressionSpecification}

cns-solutions-admin avatar Jul 26 '22 12:07 cns-solutions-admin

Actually seems like the data is not optional although marked as such in the docs: https://maplibre.org/maplibre-gl-js-docs/style-spec/sources/#geojson

A GeoJSON source. Data must be provided via a "data" property, whose value can be a URL or inline GeoJSON.

I think the problem is with v8.json file where data inside geojson_source is not marked as required: true. See here: https://github.com/maplibre/maplibre-gl-js/blob/964b2a7405a7508c3cd4be4eb1da7f03a7a14f67/src/style-spec/reference/v8.json#L382

The docs are basically contradicting itself...

I agree about the clusterProperties, they are defined here unfortunately without a proper type: https://github.com/maplibre/maplibre-gl-js/blob/964b2a7405a7508c3cd4be4eb1da7f03a7a14f67/src/style-spec/reference/v8.json#L431

Some classes are generated from this file in order to make sure they are aligned, it's not an easy task :-) Feel free to submit a PR to solve this and thanks for all the hard work related to fixing the types! truly appreciated! Also let me know if you would like to help out further by being an official contributor to this library.

HarelM avatar Jul 26 '22 13:07 HarelM