Skip to content

Conditional Symbol markerFile #1843

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

Open
jokroese opened this issue Nov 17, 2022 · 3 comments
Open

Conditional Symbol markerFile #1843

jokroese opened this issue Nov 17, 2022 · 3 comments
Labels

Comments

@jokroese
Copy link

maptalks's version and what browser you use?

Maptalks version: 1.0.0-rc.14
Browser: Firefox, 106.0.5

Issue description

I have a geojson file with several features in. I want to use different symbols for representing each of the features, conditional on values of the feature (such as latitude, longitude and other properties).

I would expect to be able to use a standard if, else function to assign a symbol to each feature (as shown in the reproduction URL).

However, doing this leads the symbols to overlap on each other. Specifically:

  • the first feature in the collection is shown with the correct symbol correctly
  • the second feature is shown with the correct symbol and the symbol of the first feature.
  • so on...

Please provide a reproduction URL (on any jsfiddle like site)

https://codepen.io/jokroese/pen/NWzwPeV

Note how the symbol for Berlin (the second feature of the collection) has both the (correct) Berlin symbol and the (incorrect) London symbol.

@deyihu
Copy link
Collaborator

deyihu commented Nov 18, 2022

I made a simple example, https://codepen.io/deyihu/pen/jOKaqJB?editors=0010 Because I don't fully understand your needs, I'm not sure if it's what you want @joekroese

@jokroese
Copy link
Author

jokroese commented Nov 18, 2022

Hi @deyihu! I'll try to be clearer with what I'm trying to do :)

What I am trying to do is:

  • have the symbol of the eye be the only symbol for London (the western coordinates in the example) and
  • the tower be the only symbol for Berlin (the eastern coordinates in the example)

The problem is that, instead of just showing the tower in Berlin, it shows both the eye and the tower.

@jokroese
Copy link
Author

In other words:

I have a single GeoJSON file with type FeatureCollection. How can I represent the features with multiple different symbols?

@deyihu deyihu added the question label Jul 4, 2024
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