koopjs / FeatureServer

An open source Geoservices Implementation (deprecated)
https://geoservices.github.io
Other
104 stars 32 forks source link

Add ability to send custom symbology for feature server #80

Closed jptheripper closed 4 years ago

jptheripper commented 6 years ago

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.

SergeyBarskiy commented 6 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.

dmfenton commented 6 years ago

yeah this needs to be set in the geojson.metadata response

SergeyBarskiy commented 6 years ago

@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

hhkaos commented 5 years ago

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.

ButchGis commented 5 years ago

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.

rgwozdz commented 5 years ago

@ButchGis - nice work. Do you want to PR this? My only suggestion is metadata.renderer instead of metadata.KOOP_SYMBOL.

ButchGis commented 5 years ago

Sure. After holiday weekend. Thanks.

Get Outlook for Android<https://urldefense.proofpoint.com/v2/url?u=https-3A__aka.ms_ghei36&d=DwIF-g&c=n6-cguzQvX_tUIrZOS_4Og&r=gaXh_UY66bShHyUniiKvr2y8f7txAbZ2YP9NAxfryTwYfU14pw1Erm4X35nCrmtDYkm4b67Bq9g9dFNcCMIRVHmIcd8vkOnCPsOjTvHme1U&m=CdtiI9R0mON0i1AE-8XpA1IzBpuue2fjNUG7OFmhx-A&s=gNQKeqo4jn3JWZgEqzDqFjb4bXkq_xKLc8Lkk8aBWX0&e= >


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=.

hparkertt commented 4 years ago

@jptheripper @rgwozdz @ButchGis I think this issue can be closed thanks to #162 ?