{"action":"created","issue":{"url":"https://api.github.com/repos/mapbox/mapbox-gl-js/issues/1399","repository_url":"https://api.github.com/repos/mapbox/mapbox-gl-js","labels_url":"https://api.github.com/repos/mapbox/mapbox-gl-js/issues/1399/labels{/name}","comments_url":"https://api.github.com/repos/mapbox/mapbox-gl-js/issues/1399/comments","events_url":"https://api.github.com/repos/mapbox/mapbox-gl-js/issues/1399/events","html_url":"https://github.com/mapbox/mapbox-gl-js/issues/1399","id":98210894,"number":1399,"title":"How to modify feature properties at runtime?","user":{"login":"ezheidtmann","id":1178915,"avatar_url":"https://avatars.githubusercontent.com/u/1178915?v=3","gravatar_id":"","url":"https://api.github.com/users/ezheidtmann","html_url":"https://github.com/ezheidtmann","followers_url":"https://api.github.com/users/ezheidtmann/followers","following_url":"https://api.github.com/users/ezheidtmann/following{/other_user}","gists_url":"https://api.github.com/users/ezheidtmann/gists{/gist_id}","starred_url":"https://api.github.com/users/ezheidtmann/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ezheidtmann/subscriptions","organizations_url":"https://api.github.com/users/ezheidtmann/orgs","repos_url":"https://api.github.com/users/ezheidtmann/repos","events_url":"https://api.github.com/users/ezheidtmann/events{/privacy}","received_events_url":"https://api.github.com/users/ezheidtmann/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":16,"created_at":"2015-07-30T16:28:44Z","updated_at":"2016-10-05T19:51:40Z","closed_at":"2015-07-30T17:59:14Z","body":"This is probably a support request or a request for documentation. Thanks for your help!\r\n\r\nWhile waiting for [data-driven styles](https://github.com/mapbox/mapbox-gl-style-spec/issues/249) and/or [arithmetic operations](https://github.com/mapbox/mapbox-gl-style-spec/issues/47) in the style spec, I have a need to style my features based on values which can be calculated from feature properties. I think I could do this if I could add new properties to features as they arrive, and modify loaded features when I need to change the style. How can I iterate through all features and add or modify properties?\r\n\r\nHere's an example. I have a feature with these properties:\r\n\r\n```\r\n    \"properties\": {\r\n      \"alltime_total_uses\": 169, \r\n      \"id\": 472,\r\n      \"alltime_total_uses_bad\": 7, // negative rating\r\n      \"alltime_total_uses_good\": 68 // positive rating\r\n    }\r\n```\r\n\r\nAnd let's say I'm coloring the features based on the property `alltime_total_uses_bad`. Then the user asks for the features to be colored based on the number of uses without any rating, i.e. `total - bad - good`. I could add a property called `alltime_total_uses_unrated` and then adjust the filters on my style to change the appearance of the map.\r\n\r\nThe volume and combination of options that I'd like to support makes it impractical for the backend to provide  all these properties in the original tiles.\r\n\r\nThanks again for any advice! I will update this issue if I find a solution that works for me."},"comment":{"url":"https://api.github.com/repos/mapbox/mapbox-gl-js/issues/comments/251780189","html_url":"https://github.com/mapbox/mapbox-gl-js/issues/1399#issuecomment-251780189","issue_url":"https://api.github.com/repos/mapbox/mapbox-gl-js/issues/1399","id":251780189,"user":{"login":"timrobertson100","id":237221,"avatar_url":"https://avatars.githubusercontent.com/u/237221?v=3","gravatar_id":"","url":"https://api.github.com/users/timrobertson100","html_url":"https://github.com/timrobertson100","followers_url":"https://api.github.com/users/timrobertson100/followers","following_url":"https://api.github.com/users/timrobertson100/following{/other_user}","gists_url":"https://api.github.com/users/timrobertson100/gists{/gist_id}","starred_url":"https://api.github.com/users/timrobertson100/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/timrobertson100/subscriptions","organizations_url":"https://api.github.com/users/timrobertson100/orgs","repos_url":"https://api.github.com/users/timrobertson100/repos","events_url":"https://api.github.com/users/timrobertson100/events{/privacy}","received_events_url":"https://api.github.com/users/timrobertson100/received_events","type":"User","site_admin":false},"created_at":"2016-10-05T19:51:40Z","updated_at":"2016-10-05T19:51:40Z","body":"@strech345 - I ended up producing vector tiles on the fly with the data I needed.  Would that be possible?\r\n\r\nYou can't get at the tile in the browser easily.  I tried, and it is very invasive changes to the javascript which would be difficult to maintain over time."}}
{"actor":{"display_login":"timrobertson100"}}