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

Geojson names not imported #957

Open
ninoppp opened this issue Nov 16, 2024 · 4 comments
Open

Geojson names not imported #957

ninoppp opened this issue Nov 16, 2024 · 4 comments

Comments

@ninoppp
Copy link

ninoppp commented Nov 16, 2024

Maputnik version:newest
Browser: Firefox&Chrome
OS:Linux&Windows

Description of the bug:
I added a data source (json, url). The features from the source do indeed show up, but without the names they have in the geojson. Clicking on every feature shows undefined, while they have properties to them i.e. on geojson.io. This makes it impossible to use the filters I want
Steps to reproduce the behavior:

  1. Add a data source,json(url). I used this one
  2. Make a layer with the data source, fill.
  3. Click on the visible layer

Screenshots:
image

Btw great software otherwise!

@HarelM
Copy link
Collaborator

HarelM commented Nov 16, 2024

Thanks for taking the time to open this issue!
I belive the code is expecting tilejson file to know which layers to inspect, and geojson source has only "one" layer.
Maputnik is basically using maplibre-inspect plugin, any chance you could check if it has the same issue?

@zstadler
Copy link
Collaborator

In order for the name to appear, please add a symbol layer to the style.

This style works for me: maputnik_issue_geojson_names_not_imported_#957.json

image

@ninoppp
Copy link
Author

ninoppp commented Nov 18, 2024

@zstadler okay, maybe I'm stupid and am using the filters wrong. Would you mind giving me an example, how I can filter so only features without "example1" or "example" in their names are dispalyed?

@zstadler
Copy link
Collaborator

No, you are not stupid. You just need to learn more.

Here is how you filter-out elements that have "Status unknown":

      "filter": ["==", -1, ["index-of", "Unknown status", ["get", "name"]]],

The expression ["index-of", "Unknown status", ["get", "name"]] searches for the sub-string "Unknown status" in the "name" field/property. If it is not found, the result is -1.
The filter is defined to accept only features that got a -1 result: elements that do not have "Unknown status" in their name.

An updated style file is attached.
maputnik_issue_geojson_names_not_imported_#957.json

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

3 participants