Closed jptheripper closed 4 years ago
Overwriting templates does not work well if I want to have custom symbol per layer. Ideally if I set metadata.drawingInfo.renderer the templates.js would leave it along and only set the rendered if it is undefined or null.
yeah this needs to be set in the geojson.metadata response
@dmfenton I think this line if (json.drawingInfo) json.drawingInfo.renderer = renderers[json.geometryType] should be if (json.drawingInfo && ! json.drawingInfo.renderer) json.drawingInfo.renderer = renderers[json.geometryType] Possibly similar checks need to exist for other properties on the json response. More like the code for displayField: if (json.displayField) json.displayField = metadata.displayField || json.fields[0].name
I'm also struggling with this, so I have changed templates.js:
if (json.drawingInfo) json.drawingInfo.renderer = renderers[json.geometryType]
For:
if (json.drawingInfo && metadata.drawingInfo) json.drawingInfo = metadata.drawingInfo;
I copied the drawingInfo field from the webmap spec and it worked perfectly.
In the provider, I am setting the layer metadata with an additional property: KOOP_SYMBOL. like so: metadata.KOOP_SYMBOL = the json for a renderer
Currently, I have a koop provider cycling through a configurable set of point renderers. Mostly just changing color.
I had to modify 1 line in FeatureServer.
At line 42 in template.js I changed, "json.drawingInfo.renderer = renderers[json.geometryType]", to "json.drawingInfo.renderer = metadata.KOOP_SYMBOL || renderers[json.geometryType]"
Maybe a better name of the metadata attribute could be chosen. But this seems to allow the desired functionality of setting symbol per layer at provider.
@ButchGis - nice work. Do you want to PR this? My only suggestion is metadata.renderer
instead of metadata.KOOP_SYMBOL
.
Sure. After holiday weekend. Thanks.
From: Rich Gwozdz notifications@github.com Sent: Friday, August 30, 2019 12:13:37 PM To: koopjs/FeatureServer FeatureServer@noreply.github.com Cc: Anthony Fragale AFragale@esri.com; Mention mention@noreply.github.com Subject: Re: [koopjs/FeatureServer] Add ability to send custom symbology for feature server (#80)
@ButchGishttps://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_ButchGis&d=DwMCaQ&c=n6-cguzQvX_tUIrZOS_4Og&r=CjzKn4LMK8XMlUn2RqpGT4XBjFCdyudPrnhO5cbl08k&m=eRYGuTp1LUp2ds5jsKmPxQF5m4mWP7KNBO0El3YC93I&s=5eOz1bEIqdpNWpZHiu6NPltzHqaBoNX6Lg1UJbOspC8&e= - nice work. Do you want to PR this? My only suggestion is metadata.renderer instead of metadata.KOOP_SYMBOL.
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_koopjs_FeatureServer_issues_80-3Femail-5Fsource-3Dnotifications-26email-5Ftoken-3DAH2TAV4PT6RSQJDQBDMVNCDQHFBLDA5CNFSM4EU3GU5KYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD5SDGCY-23issuecomment-2D526660363&d=DwMCaQ&c=n6-cguzQvX_tUIrZOS_4Og&r=CjzKn4LMK8XMlUn2RqpGT4XBjFCdyudPrnhO5cbl08k&m=eRYGuTp1LUp2ds5jsKmPxQF5m4mWP7KNBO0El3YC93I&s=L41F9MKMsFpEyDsHb3Pp53gQkzdcSu3zwLpf1k9NpK0&e=, or mute the threadhttps://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_notifications_unsubscribe-2Dauth_AH2TAVYZVMFIAYRHARSRISTQHFBLDANCNFSM4EU3GU5A&d=DwMCaQ&c=n6-cguzQvX_tUIrZOS_4Og&r=CjzKn4LMK8XMlUn2RqpGT4XBjFCdyudPrnhO5cbl08k&m=eRYGuTp1LUp2ds5jsKmPxQF5m4mWP7KNBO0El3YC93I&s=ffKInL9rAQhQ-l-twxcqt5d7--Zvob4UYofb1cUnyHc&e=.
@jptheripper @rgwozdz @ButchGis I think this issue can be closed thanks to #162 ?
You currently have to over the point.json (or line, fill-symbol, polygon) files in \node_modules\featureserver\templates\renderers\symbology to override FeatureServer symbology. Please add the ability to pass a custom json file at the provider level.