Select to view content in your preferred language

Adding Operational Layers

3350
24
06-10-2011 07:25 AM
JamesArmstrong
Occasional Contributor
ArcGIS 9.3.1
ArcServer 9.3.1
Flexviewer 2.3.1
Status: newbie

I have downloaded the flexviewer and got it running on my ArcServer using the default config.xml file. I have changed the initial extent as well as added a wkid= 2264 (North Carolina) to the intitialextent line.  The site seems to work fine.

Then I add my own operational layer (from my server)- and I get an error and the site will not load.  If this layer is commeted out, the site again works fine.  Spent last few days researching ans trying different things.  I have learned alot, but not how to solve this issue.  Any suggestion or points in the right direction will be greatly appreciated.  Below is the <map> portion of my config file and I have attached the screen shot of the received error.  The site is still in test mode and not open to general internet.

--------------------------------

<map initialextent="-9024000 4121000 -8800000 4222000" top="40" wkid="2264">
        <basemaps>
            <layer label="Streets" type="tiled" visible="true"
                   url="http://server.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer"/>
            <layer label="Aerial"  type="tiled" visible="false"
                   url="http://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer"/>
            <layer label="Topo"    type="tiled" visible="false"
                   url="http://server.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer"/>
        </basemaps>
        <operationallayers>
            <layer label="Demographics" type="tiled" visible="false" alpha="0.5"
                   url="http://server.arcgisonline.com/ArcGIS/rest/services/Demographics/USA_Median_Household_Income/MapServ...">
                <sublayer id="1" popupconfig="popups/PopUp_Demographics_BlockGroups.xml"/>
                <sublayer id="2" popupconfig="popups/PopUp_Demographics_Tracts.xml"/>  
                <sublayer id="3" popupconfig="popups/PopUp_Demographics_Counties.xml"/>
                <sublayer id="4" popupconfig="popups/PopUp_Demographics_States.xml"/> 
            </layer>
            <layer label="Parcels" type="feature" visible="false" alpha="1.0"
                   url="http://gis.richmondnc.com/ArcGIS/rest/services/RichmondMXD/RichmondAddTest/MapServer/5"/> 
            </layer>                 
        </operationallayers>
    </map>
0 Kudos
24 Replies
by Anonymous User
Not applicable
Original User: rscheitlin

James,

  Open back up your MXD and unhide the ObjectID and Shape Fields and republish, then clear your REST Cache using the REST Admin site and try again.
0 Kudos
JustinRobinson
Deactivated User
Hello,

You also have an error in your <layer> tag shown below in Red, you've self closed the <layer> tag with the <layer /> slash just at the end outside of the quotes for the URL as well as closing with a </layer>. If you remove this / or remove the </layer> tag just below it, it should work.

In XML you have two ways of closing a tag, either self closing with the <tag /> form or the open and close tags <tag> </tag>. It will error if you use both, as the <tag /> will already be closed when attempting to create a closing </tag>.

</layer> 
<layer label="Parcels" type="feature" visible="false" alpha="1.0"
url="http://gis.richmondnc.com/ArcGIS/rest/services/RichmondMXD/RichmondAddTest/MapServer/5"/> 
</layer> 
0 Kudos
by Anonymous User
Not applicable
Original User: Richmondgis

Thanks for the assist.  I was able to add my Parcel Layer to config.xml.  Though the re-projecting  caused a huge proformance problem, the previous error dissappeared and the layer showed up in the opererational layers list.  The only thing is that the data for the parcel layer does not show up.  Perhaps it is a symbology issue.  Any suggestions will be graciously accepted.

JEA
0 Kudos
MeganBirch
Regular Contributor
I am new to Flex I am having the same issue.  The parcels layer appears in the list, but does not draw. I didn't define the wkid, although my operational layers are in a different projection than the ESRI base map I'm using.  Is that a problem?  The interesting thing is that I'd gotten the parcels layer to work in the 2.2 version, copied the code over into the 2.3 config.xml, added the popupconfig line, and it no longer worked.  Any help is appreciated.

Here is my code:

<map wraparound180="true" initialextent= "-8653000 4862000 -8409000 4978000" fullextent="-8653000 4862000 -8409000 4978000" top="40">>
        <basemaps>
            <layer label="Streets" type="tiled" visible="true"
                   url="http://server.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer"/>
            <layer label="Aerial"  type="tiled" visible="false"
                   url="http://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer"/>
            <layer label="Topo"    type="tiled" visible="false"
                   url="http://server.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer"/>
        </basemaps>
        <operationallayers>
            <layer label="Demographics" type="tiled" visible="false" alpha="0.5"
                   url="http://server.arcgisonline.com/ArcGIS/rest/services/Demographics/USA_Median_Household_Income/MapServ...">
                <sublayer id="1" popupconfig="popups/PopUp_Demographics_BlockGroups.xml"/>
                <sublayer id="2" popupconfig="popups/PopUp_Demographics_Tracts.xml"/>  
                <sublayer id="3" popupconfig="popups/PopUp_Demographics_Counties.xml"/>
                <sublayer id="4" popupconfig="popups/PopUp_Demographics_States.xml"/> 
            </layer>
            <layer label="Parcels" type="dynamic" visible="false"
                   url = "http://arcims/ArcGIS/services/testparcels/MapServer"/>
     popupconfig="popups/Popup_Parcels.xml"/>
     <layer label="Fires" type="feature" visible="false" alpha="1.0"
                   popupconfig="popups/PopUp_Fires.xml"
                   url="http://sampleserver3.arcgisonline.com/ArcGIS/rest/services/Fire/Sheep/FeatureServer/0"/>                  
        </operationallayers>
    </map>
0 Kudos
by Anonymous User
Not applicable
Original User: xemoka

Hi Megan,

There's a couple things wrong in your config file there. Your popups are not configured correctly. Take a look at the ESRI Viewer Docs but in brief:

Popups are generally configured in a <sublayer> tag, if you are configuring them for a single map feature layer it is possible to do as you have, by including it in the <layer> tag, however it has to be while the layer tag is still open. In your code you've self closed the layer tag by <layer ... /> and then called the popupconfig parameter outside of the closed layer tag. The popup would have to be set before that / .

I believe for dynamic types you must use the sublayer tag, in which case the initial <layer..> must not be self closed, and instead be later closed by a </layer>.

I.E.:
<layer ...>
    <sublayer id="x" popupconfig="popups/example.xml" />
</layer>


In which case

<layer label="Parcels" type="dynamic" visible="false"
url = "http://arcims/ArcGIS/services/testparcels/MapServer"/>
popupconfig="popups/Popup_Parcels.xml"/>


should be:

<layer label="Parcels" type="dynamic" visible="true" url="http://arcims/ArcGIS/services/testparcels/MapServer">
     <sublayer id="x" popupconfig="popups/Popup_Parcels.xml"/>
</layer>
0 Kudos
MeganBirch
Regular Contributor
Justin,

Thank you for your response.  I made the changes you suggested, but the layer still does not appear.  I even took out the popupconfig altogether, with no change. 

<layer label="Parcels" type="dynamic" visible="false" alpha = "0.5"
                   url = "http://arcims/ArcGIS/services/testparcels/MapServer">
     </layer>

I also tried changing the service type to feature since the service only contains one feature class (and therefore no sublayers), without success:

            <layer label="Parcels" type="feature" visible="false" alpha = "0.5"
                   url = "http://arcims/ArcGIS/services/testparcels/MapServer/FeatureServer">
     </layer>

I'm beginning to think that the problem might be with my service and not my code.  But since the following worked in the previous version of the template, I'm not certain about that:

<operationallayers>
    <layer label="Parcels" type="dynamic" visible="true"
     url = "http://arcims/ArcGIS/rest/services/testparcels/MapServer"/>   
</operationallayers>

Although, in the previous version, I did notice that in the layers list the Parcels could be expanded, which is not the case in the new version, so something must be different.  If you have any other thoughts, I'd appreciate them.
0 Kudos
by Anonymous User
Not applicable
Original User: xemoka

Hi Megan,

Could the highlighted parameter be the issue?

<layer label="Parcels" type="dynamic" visible="false" alpha="0.5"
   url="http://arcims/ArcGIS/services/testparcels/MapServer">
</layer>


Visible must = true for the service to show,
0 Kudos
MeganBirch
Regular Contributor
According to the help (ArcGIS Viewer for Flex -->Configure the Viewer--> The Layer Tag), visible "Determines whether the layer is visible or not when the application first opens. Boolean value, default is "false"." Regardless, I've tried it both ways with the same result.
0 Kudos
by Anonymous User
Not applicable
Original User: scottprindle

You will want to ensure you are pointing to the REST endpoint for your map service in your config.xml file. Right now it looks like the code is referencing:

<layer label="Parcels" type="dynamic" visible="true" alpha="0.5"
url="http://arcims/ArcGIS/services/testparcels/MapServer">
</layer>

When it should be:

<layer label="Parcels" type="dynamic" visible="true" alpha="0.5"
url="http://arcims/ArcGIS/rest/services/testparcels/MapServer">
</layer>
0 Kudos