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

[Bug] GeoJsonLayer accessors receive different payloads when data is binary #9180

Open
7 tasks
aethr opened this issue Sep 25, 2024 · 2 comments
Open
7 tasks
Labels

Comments

@aethr
Copy link

aethr commented Sep 25, 2024

Description

When using GeoJsonLayer with binary data, layer accessors receive a feature object which is missing important fields such as id. When creating a GeoJsonLayer with the same feature in GeoJSON format, the id field is present.

Example feature:

{
  "type": "Feature",
  "id": 1,
  "properties": {
    "foo": "bar"
  },
  "geometry": { "type": "Point", "coordinates": [0.60888671875, 0.556884765625] }
}

Creating a GeoJsonLayer from this feature, and providing it as a normal GeoJSON object, accessors such as getText will receive the object:

{
    "type": "Feature",
    "id": 1,
    "properties": {
        "foo": "bar"
    },
    "geometry": {
        "type": "Point",
        "coordinates": [
            0.60888671875,
            0.556884765625
        ]
    }
}

With no other changes, but supplying data to the layer as binary, the same accessor receives the object:

{
    "properties": {
        "foo": "bar"
    }
}

Flavors

  • Script tag
  • React
  • Python/Jupyter notebook
  • MapboxOverlay
  • GoogleMapsOverlay
  • CartoLayer
  • ArcGIS

Expected Behavior

Although it may not be feasible to reconstruct the entire feature object for performance reasons, it would be really useful to still have access to the id field within accessors. This is useful for features like having a highlighted feature (not using autoHighlight) which is based on the feature's id.

Steps to Reproduce

https://codepen.io/aethrXor/pen/gOVbrGv?editors=0010

Environment

Logs

No response

@aethr aethr added the bug label Sep 25, 2024
@aethr
Copy link
Author

aethr commented Sep 25, 2024

As a workaround I am currently duplicating the id in the properties object as well, but it means I'm sending some unnecessary data in my MVT responses that I'd like to avoid.

@Pessimistress
Copy link
Collaborator

@felixpalmer It should be trivial to add the id here?

function getPropertiesForIndex(

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

No branches or pull requests

2 participants