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
add support for dynamicLayers #566
Comments
i'm not sure whether or not it'd be a good idea to add official 'support' for dynamic-layers in the API that's just an opportunity to pass in your own hand constructed JSON, but i did a quick test and it was pretty simple to add in... getDynamicLayers: function(){
return this.options.dynamicLayers;
},
setDynamicLayers: function(dynamicLayers){
this.options.dynamicLayers = dynamicLayers;
this._update();
return this;
}
// ...
_buildExportParams: function () {
// ...
if(this.options.dynamicLayers){
params.dynamicLayers = this.options.dynamicLayers;
}
// ...
// then
L.esri.dynamicMapLayer('http://server/arcgis/rest/services/name/MapServer', {
dynamicLayers: [
{
"id": foo,
"name": "bar",
"source": {
"type": "mapLayer",
"mapLayerId": 2
},
"drawingInfo": {
...
}
}
]
}).addTo(map); you can find a complete working sample below: let me know if you have any more questions about it |
Well, it's not on the roadmap, and from my experience, working w/ the LayerDrawingOptions can be complex (esp w/r/t renderers). I won't speak for @patrickarlt, but I wouldn't count on specific support for this. I think your idea of "dropping in your own JSON string" is a good one though. So L.esri.Layers.DynamicMapLayer (and even all the other layers/tasks) could have a method like |
i like the idea @tomwayson, but what else did you have in mind in the way of uncommon parameters? |
I don't have anything else in mind. Really it's just things like this, where the implementation of a specific parameter could be complicated and not often used. Would be nice to have a way for the user to specify custom parameters as an extensibility point. |
i still like the idea. im just going to rename the issue, add a FAQ tag and shelf for now, but the next time someone wants to insert a custom parameter into a request i'll take a 🔪 at implementing your suggestion. |
@tomwayson You got it wrong! I actually like the idea of supporting |
hah. color me surprised. are you saying you want what i already demoed above (which requires the developer to know what JSON they'd like to pass in) or actual helper methods to create JSON for them? |
As much as I would love to have helper methods for the JSON its just to much of a mess to support everything. Its one of those advanced features that only a few people use and is really easy to implement so just needing to know the JSON object is fine by me. |
i agree. actual support would be a beast. i'll PR based on my suggestion above sometime soon, and make sure to include the appropriate documentation updates and corresponding tests. if anyone else wants to help, that would be dandy too |
can't be right all the time ¯_(ツ)_/¯ |
Thanks everyone! |
Similar to the JSAPI, is it possible to get the initial Dynamic Layer Infos using this leaflet plugin? After the layer is loaded and call getDynamicLayers(), nothing is returned. |
we don't provide a wrapper method, but you can fetch the metadata for the service pretty easily and dig in for the 'layers' using var mapUrl = 'http://sampleserver6.arcgisonline.com/arcgis/rest/services/Census/MapServer';
L.esri.request(mapUrl, {}, function (error, response) {
console.log(response.layers);
}) |
Hello,
I was wondering if Esri-Leaflet would support some method to populate the dynamicLayers parameter. The use case is that I would like to reorder the internal feature classes in a AGS dynamic layer as shown here
http://developers.arcgis.com/javascript/samples/layers_dynamic_reorder/
I think this is 10.1 feature and just letting us sort out and drop in our own JSON string would be fine.
Thanks,
Paul
The text was updated successfully, but these errors were encountered: