Select to view content in your preferred language

How do I know programmatically if to use a dynamic or tiled map service?

1572
8
06-15-2013 01:06 AM
MathiasDahl
New Contributor III
Hi,

We are building a quite special integration with ArcGIS where we want
the services and their layers to be chosen according to a certain
configuration each time the map application is loaded. So in one
situation the map will show layer X, Y and Z from service A and B and
in another situation we will show other layers from other
services. The code has to be dynamic.

My question is now, given a certain map service, how can I know if I
should create a dynamic map service layer or a tiled map service
layer? Since my web page, the actual map application, will get the
list of layers/services sent to it I would like to programatically ask
the service or the ArcGis Server directory what type it is.

From what I can gather there is no easy way to distinguish between a
tiled map service and a dynamic one. A feature service will be
published under a URL with "FeatureServer" in the path, but for the
map services it will always be "MapServer".

Any ideas on how to do this? If it cannot be done, the administrator
who defined has to specify the type of a service in the basic data we
are building for this, but I would like to avoid that if possible to
not put that burden on the admin.

Thanks!

/Mathias
8 Replies
OrenGal
New Contributor III
My suggestion is to you:
1. Write in the parameter file for each layer the url and the type.
2. In code, analyze the line add it to map.
I'm adding tiled layer as dynamic in rare cases (but existed).
Oren
0 Kudos
ReneRubalcava
Frequent Contributor II
Like Oren suggested, if you are loading from a configuration of some sort, can't you specify it there?
I have a sample showing how to load from a json config
https://github.com/odoe/agsnode-dev/blob/master/config.json

If not that way, look at the info of the map service using esri/request
http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Demographics/ESRI_Census_USA/MapServer?f=...
Check if singleFusedMapCache is true or if it has a tileInfo property.
0 Kudos
MathiasDahl
New Contributor III

Like Oren suggested, if you are loading from a configuration of some sort, can't you specify it there?


Yes I can, but I thought that if I could ask the service or the service directory in ArcGIS, that would take some load of the person setting up the configuration. So, this is my fallback if I cannot sort this out programmatically.


If not that way, look at the info of the map service using esri/request
http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Demographics/ESRI_Census_USA/MapServer?f=...
Check if singleFusedMapCache is true or if it has a tileInfo property.


That's the approach I would like to use. I compared the json output of a map service with tiles and one without it and the difference I could see was the tileInfo property. The singleFusedMapCache property was false in both the services I checked so that does not seems to be reliable. I will try to look at the tileInfo property then, although I would have wanted some property saying in a more explicit way if it is a tiled or dynamic map service. But, I am new to all this GIS stuff so maybe it is perfectly logical to look at the tileInfo property.

By the way, would the map application work if I created the wrong JavaScript object to consume a dynamic and tiled map service? Would one of those classes handle the other case in a good way, without drawbacks? If so, then I could always use that class for services with MapServer in the URL. Just a crazy idea.

Thanks for both of your quick replies!

/Mathias
0 Kudos
ReneRubalcava
Frequent Contributor II
I forgot that although they are tiled does not mean it's a fused cache so you can still disabled layers.
Can't test at moment, but I seem to remember serving tiled data as dynamic provided a grainy looking map and serving dynamic as tiled loaded the data in weird tiles that didn't line up correctly.
0 Kudos
MathiasDahl
New Contributor III
I forgot that although they are tiled does not mean it's a fused cache so you can still disabled layers.


That's almost Greek to me but okay.. 😉


Can't test at moment, but I seem to remember serving tiled data as dynamic provided a grainy looking map and serving dynamic as tiled loaded the data in weird tiles that didn't line up correctly.


Okay. Actually I should just test myself and see what happens 😉

Thanks!
0 Kudos
JeffJacobson
Regular Contributor
This project might be helpful to what you are trying to do.
https://github.com/WSDOT-GIS/LayerFactory
0 Kudos
MathiasDahl
New Contributor III
This project might be helpful to what you are trying to do.
https://github.com/WSDOT-GIS/LayerFactory


Thanks!

I looked at the layer factory there and it seems to look at the singleFusedMapCache to determine if it is a dynamic or tiled map service:

        if (response.singleFusedMapCache) {
                // Create a tile map service layer.
                require(["esri/layers/agstiled"], function () {
                        var layer;
                        layer = new esri.layers.ArcGISTiledMapServiceLayer(url, layerOptions);
                        self._triggerLayerCreate(layer);


/Mathias
0 Kudos
MathiasDahl
New Contributor III
Thanks!

I looked at the layer factory there and it seems to look at the singleFusedMapCache to determine if it is a dynamic or tiled map service:

        if (response.singleFusedMapCache) {
                // Create a tile map service layer.
                require(["esri/layers/agstiled"], function () {
                        var layer;
                        layer = new esri.layers.ArcGISTiledMapServiceLayer(url, layerOptions);
                        self._triggerLayerCreate(layer);


/Mathias


I checked the open maps available here at ArcGIS Online (http://sampleserver1.arcgisonline.com/ArcGIS/rest/services) and it seems that every map service of type MapServer that has tile information also has the singleFusedMapCache property set to true. So it seems I can trust that after all. From my earlier investigations I think I found one case where this property was false and that there were tile information as well, but I cannot find that now so probably I was mistaken.

Thanks!
0 Kudos