-
-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Improve documentation for ol.Feature #2378
Conversation
* By default, the geometry property name is `geometry`, but this may be | ||
* changed at any time using the `setGeometryName` method. When the geometry | ||
* of a feature is requested, the current geometry property name is used so | ||
* that rendered geometry associated with a feature may be changed on the fly. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a tough thing to explain. What do you think about something like this:
Typically, a feature has a single geometry property. You can set this with the setGeometry
method and get it with getGeometry
. It is possible to store more than one geometry on a feature. By default, the geometry used for rendering is set as a property named 'geometry'
. If you want to use another geometry property for rendering, use the setGeometryName
method.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is possible to store more than one geometry on a feature
what's the use case(s) for this? It's always easier to explain things with examples. This departs from the concept of features in formats like GeoJSON or KML
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
e.g. a polygon feature with its center point for labeling explicitly set in the feature as a second geometry
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok, then I think it would be helpful for that (or other) examples to be given in the docs
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know this is the theory behind how this works, but is it actually possible with the current architecture to use more than one geometry simultaneously - to draw a polygon and label its center point (where the center point is provided by a second geometry)? I haven't seen anything that leads me to think this is possible right now. It might be nice if a layer or style could be configured with a geometry property name.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not sure but GML supports it and our GML reader supports it as well
* for rendering, use the `setGeometryName` method to change the attribute | ||
* property associated with the geometry for the feature. For example: | ||
* | ||
* var feature = new ol.Feature({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
put this in a js backtick block
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indenting 4 spaces has the same effect I think.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
adding 'js' gives you highlighting - tho I agree that's not a big deal :-)
Thanks for the review @probins, all good catches! |
otherwise, LGTM |
I've changed the example to use backticks for js source highlighting as suggested by @probins, will merge when travis is happy. |
Improve documentation for ol.Feature
This adds a bit more substance to the
ol.Feature
documentation.