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

RFeature properties #11

Closed
fredleput opened this issue Sep 3, 2021 · 2 comments
Closed

RFeature properties #11

fredleput opened this issue Sep 3, 2021 · 2 comments

Comments

@fredleput
Copy link

Hi,

I see in the API that RFeature can have a "properties" value : <Record, unknown>. Is there an example on how to use it ?

What i would like :

<RFeature 
  key={record.fields.id}  
  geometry={new Point(fromLonLat([record.geometry.coordinates[0], record.geometry.coordinates[1]]))}
  properties={{'prop1':value1}, {'prop2':value2}} 
  onClick={featureClickHandler}
>                            
</RFeature> 

And im my featureClickHandler function :

const prop1 = e.properties.prop1

Thx,

Fred.

@mmomtchev
Copy link
Owner

The high performance example has the pilot name in a feature property called 'PLT' and the Add-Delete example uses the feature id in its handler
You need to call feature.get('somepropertyname')
If you are in the onClick handler you should use e.target.get('propertyname')

@fredleput
Copy link
Author

Thx a lot !

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

2 participants