-
Notifications
You must be signed in to change notification settings - Fork 0
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
Set color of polygon with color set in the geojson feature properties #381
Conversation
✅ Deploy Preview for oslmap ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
- Default to geojsonColor is this properties color object does not exist
94e7ee3
to
badfac1
Compare
: hexToRgba(this.geojsonColor, 0), | ||
}), | ||
}), | ||
style: function (this: MyMap, feature: any) { |
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.
Was struggling to add the specific type for feature
.
Tried adding feature: Feature
and feature: typeof Feature
with no luck even though this is an instance of 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.
No worries here, OpenLayers can be finiky about this - it might be:
import { Feature } from "ol/index";
style: function (this: MyMap, feature: Feature<Geometry>) {...}
But if that still complains, feel free to leave this as any
and I can re-visit later!
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.
Yeah still complaining 😕 .
Let me know if you do figure this one out, i'm intrigued now !
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.
Thanks again for this ! Tested and works perfectly 🎨
Left a small type suggestion, but no pressure to spend time on that if not straightforward. Happy for this to be "Squashed & merged" anytime and I'll get the new release through before end of day for you!
: hexToRgba(this.geojsonColor, 0), | ||
}), | ||
}), | ||
style: function (this: MyMap, feature: any) { |
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.
No worries here, OpenLayers can be finiky about this - it might be:
import { Feature } from "ol/index";
style: function (this: MyMap, feature: Feature<Geometry>) {...}
But if that still complains, feel free to leave this as any
and I can re-visit later!
}), | ||
style: function (this: MyMap, feature: any) { | ||
// Retrieve color from feature properties | ||
let featureColor = feature.get("color") || this.geojsonColor; // Use the geojsonColor if no color property exists |
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.
🙌 smart & simple !
"properties": {"color": "#e670fc"}
https://trello.com/c/IQsb3WNF/1908-improve-content-and-layout-for-querying-neighbour-addresses-by-polygon-search