New AGS Mapservice Layers Not Showing in AGOL WebMap

7598
19
06-01-2018 12:13 PM
MichaelVolz
Esteemed Contributor

I have an AGOL webmap that originates from an ArcGIS Server (AGS) mapservice which has been in operation for several months.  Last month many new layers were added to the mxd for the mapservice and these layers appeared in the webmap after the mapservice was republished.  More changes were made this week and after republishing the changes were seen in the mapservice's REST endpoint, but are not seen in the webmap.

Has anyone ever encountered this scenario and would know how to fix the problem?   

19 Replies
JonathanQuinn
Esri Notable Contributor

Are you adding the whole map service to the webmap? Do you have any definition queries or filters? Looking at the parameters of the exportMap operation should tell you why certain layers don't come through.

0 Kudos
MichaelVolz
Esteemed Contributor

Jonathan:

The new layers are available at rest endpt, just not in the webmap.

How exactly do I use the exportMap operation to tell why certain layers don't come through?

So I went into the mxd that is the datasource for the mapservice that is being passed thru AGOL and I retrieved the bounding box for an area where a feature from the new layers should appear, which it does with the exportMap operation.  As such why would these new layers show up in the rest endpt and in the exportMap, but not in the AGOL webmap?

0 Kudos
MichaelVolz
Esteemed Contributor

I have some more information in regards to the new layers in the mapservice that might be the issue which I had not picked up on until now.  There are 4 fields in each new layer with Text data types and Length of 2147483598.  Would a field length such as this cause issues with the layers appearing in an AGOL webmap as I can see the layer with the ArcGIS Javascript viewer from the REST endpt?

0 Kudos
JonathanQuinn
Esri Notable Contributor

So you've confirmed that the service works, so it appears to be a client side problem, in this case AGOL or the webmap. I would take a look at the requests from the webmap using Fiddler or the browsers dev tools and determine how the request is different. You can also just try to bring in the service in a new webmap and see if they show up, which would confirm it's a webmap problem. If they don't show up, then it could be a problem with certain field types or lengths, as you're speculating.

0 Kudos
MichaelVolz
Esteemed Contributor

Jonathan:

Does this idea:

https://community.esri.com/ideas/13249 

cover the phenomenon I am seeing as this is expected behavior which makes updating webappbuilder apps painful.  You need to recreate the webmap if new layers are added in existing groups or above existing layers in the mxd (I updated the mxd a month ago with layers that are were all placed after the previous layers and the webmap saw the new layers after republishing the mapservice).

0 Kudos
JonathanQuinn
Esri Notable Contributor

If you're adding the whole map service to the webmap, then no, that doesn't cover it. All layers will be included in the map service so they're all included in exportMap requests, (unless, again, there's a layer filter in the webmap).

Hosted layers have to be added individually, so if you had a hosted service with layer1 in it and then add layer2 to the MXD and republish, layer2 won't show up in the map until you actually add it in.

0 Kudos
Kara_Lara
Regular Contributor

@JonathanQuinn - Bringing the same service into a new web map in AGOL does not solve it. Fields in my layer are few & simple. It appears that the AGOL JSON calling the layers & popups is not getting "refreshed" when the map image layer is being "overwritten" by publishing. This keeps happening to us & we keep having to publish it as a new map image layer, losing all popups. This is time consuming & costly for our client. If interested, please see my additional post from today in this topic.

0 Kudos
SverkerNorlander
Esri Contributor

Hi!

We've seen this issue with a few customer (I'm swedish tech support).

The solution for us has been to use Ago Assistant to edit the json data of the web map and manually add the new layers in the json data of the web map.

The problem might have something to do with popups being enabled or not, but we haven't had the time or opportunity to do extensive testing to verify this, or why this problem occurs.

Easiest when modifying the json would be to copy any of the already existing layers in the json and paste it at the end of the array and remove as much popup info as possible (I think we made it empty) and change the id.

Esri support should be able to help, but let me know if you need some assistance.

by Anonymous User
Not applicable

Echoing Sveker's point: we do this as well -- use AGOL assistant to update the web map's JSON. 

We've found that this happens when custom pop-ups are being used primarily. Support is probably the best option to get this done, but if you're in a time-crunch and are comfortable with JSON, I'm including the workflow we go through to accomplish this for you (and all others who may face the challenge).

The workflow we use is as follows:

  1. AGO Assistant Steps
    1. Open your current web map that is having the issues (i.e. not reflecting the changes) and choose the option to "Save As" and name this copied web map "DevConfMap."
    2. Create a new web map and add the service URL to the map and configure only the new layers the way you want (i.e. set their pop-up rules, modify symbology, labeling, name etc.). Save this map as "TempConfMap."
    3. Go to ago-assistant.com , login, and choose the option to 'view an item's JSON' from the main ribbon. Then find the newly created Web Map named "TempConfMap." Click on that Web Map and two panes will appear in the right side of the screen. Scroll so you see the bottom containing the actual map configuration options. Copy all the content in that pane and paste it Notepad++.
    4. In AGO Assistant, now find the Web Map we named "DevConfMap" and do the same steps as above to get the Web Map's JSON. Paste the contents into a new Notepad++ tab.
  2. Notepad++ Steps
    1. Inspect the TempConfMap json in Notepad++ and identify the layers you configured that are currently not showing up in the DevConfMap within the JSON's "layers." It'll likely look something like this:
    2.                     "id": 0,
                          "layerDefinition": {
                              "source": {
                                  "type": "mapLayer",
                                  "mapLayerId": 0
                              },
                              "drawingInfo": {
                                  "renderer": {
                                      "type": "uniqueValue",
                                      "field1": "ParkingStatus",
                                      "defaultSymbol": null,
                                      "uniqueValueInfos": [
                                          {
                                              "value": "1OpenLow",
                                              "label": "Open - Spaces Available",
                                              "symbol": {
                                                  "color": [
                                                      56,
                                                      168,
                                                      0,
                                                      142
                                                  ],
                                                  "outline": {
                                                      "color": [
                                                          153,
                                                          153,
                                                          153,
                                                          255
                                                      ],
                                                      "width": 0.75,
                                                      "type": "esriSLS",
                                                      "style": "esriSLSSolid"
                                                  },
                                                  "type": "esriSFS",
                                                  "style": "esriSFSSolid"
                                              }
                                          },
                                          {
                                              "value": "2OpenHi",
                                              "label": "Open - Near Capacity",
                                              "symbol": {
                                                  "color": [
                                                      255,
                                                      222,
                                                      62,
                                                      180
                                                  ],
                                                  "outline": {
                                                      "color": [
                                                          153,
                                                          153,
                                                          153,
                                                          255
                                                      ],
                                                      "width": 0.75,
                                                      "type": "esriSLS",
                                                      "style": "esriSLSSolid"
                                                  },
                                                  "type": "esriSFS",
                                                  "style": "esriSFSSolid"
                                              }
                                          },
                                          {
                                              "value": "4Full",
                                              "label": "Full",
                                              "symbol": {
                                                  "color": [
                                                      230,
                                                      0,
                                                      0,
                                                      162
                                                  ],
                                                  "outline": {
                                                      "color": [
                                                          153,
                                                          153,
                                                          153,
                                                          255
                                                      ],
                                                      "width": 0.75,
                                                      "type": "esriSLS",
                                                      "style": "esriSLSSolid"
                                                  },
                                                  "type": "esriSFS",
                                                  "style": "esriSFSSolid"
                                              }
                                          },
                                          {
                                              "value": "3Closed",
                                              "label": "Closed for Construction",
                                              "symbol": {
                                                  "color": [
                                                      252,
                                                      146,
                                                      31,
                                                      165
                                                  ],
                                                  "outline": {
                                                      "color": [
                                                          153,
                                                          153,
                                                          153,
                                                          255
                                                      ],
                                                      "width": 0.75,
                                                      "type": "esriSLS",
                                                      "style": "esriSLSSolid"
                                                  },
                                                  "type": "esriSFS",
                                                  "style": "esriSFSSolid"
                                              }
                                          }
                                      ]
                                  },
                                  "labelingInfo": [
                                      {
                                          "labelExpression": "[Name]",
                                          "useCodedValues": true,
                                          "maxScale": 0,
                                          "minScale": 0,
                                          "where": null,
                                          "labelPlacement": "esriServerPolygonPlacementAlwaysHorizontal",
                                          "symbol": {
                                              "color": [
                                                  47,
                                                  79,
                                                  79,
                                                  255
                                              ],
                                              "type": "esriTS",
                                              "backgroundColor": null,
                                              "borderLineColor": null,
                                              "haloSize": 0,
                                              "haloColor": null,
                                              "horizontalAlignment": "center",
                                              "rightToLeft": false,
                                              "angle": 0,
                                              "xoffset": 0,
                                              "yoffset": 0,
                                              "text": "",
                                              "rotated": false,
                                              "kerning": true,
                                              "font": {
                                                  "size": 7.5,
                                                  "style": "italic",
                                                  "decoration": "none",
                                                  "weight": "bold",
                                                  "family": "Arial Unicode MS"
                                              }
                                          }
                                      }
                                  ],
                                  "showLabels": true
                              }
                          }

      1. The index and mapLayerIndex correspond with the service's index (i.e. .../MapServer/0, .../MapServer/1, etc.). This is a good way to confirm you're looking at the right layer.
      2. Once you've identified what JSON section needs to be added (each layer has it's own section separated by commas and contained with { } brackets, copy that JSON.
    3. Inspect the DevConfMap JSON and identify the layer that is missing all of the layers. You're going to paste the copied snippet into the appropriate location (be sure to make sure the JSON is valid after you inject this JSON).
      1. Note that sometimes the formatting is not exactly the same between the source and destination web maps. If this is the case (i.e. one has mapLayerID and the other does not), the injected JSON should conform to the destination JSON.
    4. Once the JSON is confirmed as valid, return to AGO Assistant.
  3. AGO Assistant Part 2
    1. Find the "DevConfMap" in your content and choose the option to 'view an item's JSON.'
    2. Scroll to the bottom panel on the right side of the screen and choose the option to 'edit this items JSON.'
      1. It will then turn a different color.
    3. Select All and delete -- then insert the entire JSON snippet from the DevConfMap sheet in Notepad++ (i.e. the JSON after the injection).
    4. Save
    5. Go to AGOL and open DevConfMap to see if it looks right -- if so, you can make a deployment plan to update the production Web Map.
      1. If not, review the JSON and see what's going on

If you run into snags, feel free to ping me