Select to view content in your preferred language

Viewer for Flex 2.0: Simple Identify with Hyperlink

2095
10
08-11-2010 12:43 PM
JanBenson
Deactivated User
I'm a newbie working with the viewer for Flex 2.0.  I have got the bookmarks and query customized to work in the sample, but not the identify.  I would like a simple identify with the ability to hyperlink.  I presumed that is the SimpleInfoWinWidget as opposed to the InfoPopupWidget.  I tried this:

<configuration>
    <httpproxy enabled="false">proxy.php</httpproxy>
    <title>Alaska Fishing Communities</title>
    <subtitle>AK Fisheries Science Center</subtitle>
    <logo>assets/images/nlogo28.jpg</logo>
    <stylesheet>lighterside.swf</stylesheet>
<!--    <stylesheet>blackgold.swf</stylesheet> -->

    <!-- UI elements -->
    <widget right="20" top="55" config="widgets/MapSwitcher/MapSwitcherWidget.xml" url="widgets/MapSwitcher/MapSwitcherWidget.swf"/>
    <widget left="0"   top="0"  config="widgets/HeaderController/HeaderController.xml" url="widgets/HeaderController/HeaderControllerWidget.swf"/>
    <widget right="1" bottom="1" config="widgets/OverviewMap/OverviewMapWidget.xml" url="widgets/OverviewMap/OverviewMapWidget.swf"/>

    <map initialextent="-20029400 6435440 -14645605.9 11983801.7">
        <basemaps>

            <mapservice label="Streets" type="tiled" visible="true"  alpha="1"
                        url="http://server.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer"/>
            <mapservice label="Aerial"  type="tiled" visible="false" alpha="1"
                        url="http://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer"/>
            <mapservice label="Topo"    type="tiled" visible="false" alpha="1"
                        url="http://server.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer"/>
        </basemaps>
        <operationallayers>
           <layer label="Fishing Communities" type="dynamic" visible="true" alpha="1"
                   info="widgets/InfoTemplates/SimpleInfoWinWidget.swf"
                   infoconfig="widgets/InfoTemplates/SIW_Fish.xml"
                   url="http://mymapservice/arcgis/rest/services/FishMerc/MapServer"/>        
        </operationallayers>
    </map>

    <!-- widgets organized into widget containers that manage close/open etc -->
    <!-- supported layout property options: horizontal(default)|float|vertical|fix-->
    <widgetcontainer layout="float">
        <widget label="Bookmarks" x="400" y="60" icon="assets/images/i_bookmark.png"
                config="widgets/Bookmark/BookmarkWidget.xml"
                url="widgets/Bookmark/BookmarkWidget.swf"/>
        <widget label="Identify" x="590" y="300" icon="assets/images/i_table.png"
                config="widgets/Query/QueryWidget_FishingCommunities.xml"
                url="widgets/Query/QueryWidget.swf"/>
        <widget label="Identify" icon="assets/images/i_info.png"            
                config="widgets/InfoTemplates/SIW_Fish.xml"
                url="widgets/InfoTemplates/SimpleInfoWinWidget.swf"/>       
        <widget label="Earthquakes (GeoRSS)"
                icon="assets/images/i_rss.png"
                config="widgets/GeoRSS/GeoRSSWidget.xml"
                url="widgets/GeoRSS/GeoRSSWidget.swf"/>
        <widget label="Draw"
                icon="assets/images/i_draw2.png"
                config="widgets/Draw/DrawWidget.xml"
                url="widgets/Draw/DrawWidget.swf"/>
        <widget label="Print"
                icon="assets/images/i_print.png"
                config="widgets/Print/PrintWidget.xml"
                url="widgets/Print/PrintWidget.swf"/>

        <!--
        <widget label="My first widget"
                icon="assets/images/i_widget.png"
                config="widgets/Samples/HelloWorld/HelloWorldWidget.xml"
                url="widgets/Samples/HelloWorld/HelloWorldWidget.swf"/>
        -->
    </widgetcontainer>
</configuration>

SIW_Fish.xml looks like:
<?xml version="1.0" ?>
<configuration>
    <titlefield>Category</titlefield>
    <fields>Category,Link</fields>
    <datefields></datefields> <!-- field in milliseconds -->
    <zoomscale>10000000</zoomscale>
</configuration>

When I click on my identify button, a "Zoom here" pops up on the slider scale box.  Nothing happens when I click on my identify button. 

What am I doing wrong and how do I make this work?

Thanks.
Tags (2)
0 Kudos
10 Replies
BjornSvensson
Esri Regular Contributor
You need to use a single layer, not the full service. Something like:

<layer label="Fishing Communities" type="feature" visible="true" alpha="1"
info="widgets/InfoTemplates/SimpleInfoWinWidget.swf"
infoconfig="widgets/InfoTemplates/SIW_Fish.xml"
url="http://mymapservice/arcgis/rest/services/FishMerc/MapServer/0"/>

Note that both SimpleInfoWinWidget and InfoPopupWidget take advantage of a clientside layer. They are not sending a request to the server when you click (which is a different "Identify").
0 Kudos
StephenLead
Honored Contributor
Hi Bjorn,

I've tried your suggestion but I'm getting the same result as Jan - the Zoom Here popup shows, but doesn't contain any information when I click on the points.

My config.xml file contains:

<operationallayers>
        <layer label="Gold Rush" type="feature" visible="true" alpha="1"
               url="http://qsq-brcon15-pc/ArcGIS/rest/services/Atlas_goldrush/MapServer/0"/>
               info="widgets/InfoTemplates/SimpleInfoWinWidget.swf"
               infoconfig="widgets/InfoTemplates/IWT_GoldRush.xml"
</operationallayers>

<widget label="Identify" icon="assets/images/i_info.png" config="widgets/InfoTemplates/IWT_GoldRush.xml" url="widgets/InfoTemplates/SimpleInfoWinWidget.swf"/>

IWT_GoldRush.xml contains:

<?xml version="1.0" ?>
<configuration>
    <fields>XCoord</fields>
    <titlefield>XCoord</titlefield>
    <linkfield></linkfield>
    <datefields></datefields> <!-- field in milliseconds -->
    <zoomscale>5000</zoomscale>
</configuration>

http://qsq-brcon15-pc/ArcGIS/rest/services/Atlas_goldrush/MapServer/0 shows that the field XCoord exists.

Thanks for any advice,
Steve
0 Kudos
BjornSvensson
Esri Regular Contributor
Steve, that looks right...

Q. What type of field is the "XCoord"? (Look for something like Type: esriField... in the service directory).

Q. Could you use httpfox/charles/fiddler/firebug to look at the actual request for that to make sure that it indeed returns the XCoord field information.

There should first be a request for the metadata, something like:
http://qsq-brcon15-pc/ArcGIS/rest/services/Atlas_goldrush/MapServer/0?f=json

Then there should be another for the actual data, something like:
http://qsq-brcon15-pc/ArcGIS/rest/services/Atlas_goldrush/MapServer/0/query?f=json&geometry=...

What is the exact second request? (does it contain XCoord in the outFields list?)
What does the response contain? (any XCoord data?)
0 Kudos
MLowry
by
Frequent Contributor
It helps to let the forum know which version of ArcGIS Server you are using as well, due to the fact that AGS 10 has the "FeatureServer" capability, while 9.3.1 does not have this option.


For Flex 2.0, it really is best to have AGS 10 in my experience, due to the samples ESRI gives use the FeatureServer capability for the InfoPopup samples.


Try switching your type from feature to dynamic if you are not using AGS 10, and it should show up then.
0 Kudos
JanBenson
Deactivated User
Thanks for the reply!  I am running ArcGIS Server 10 with the java install.  I have a dynamic operational layer as opposed to a feature layer.  I thought Feature Server required SDE with a database (Oracle, SQL Server).  The nomenclature can be confusing.  Anyway, if I use type=feature with /rest/services/FishMerc/MapServer/0 I have the same problem with the identify..."Zoom here" with identify failing.   If I use type=dynamic with /rest/services/FishMerc/MapServer/0 my layer does not display.  I have attached images of my service with associated layer if this helps at all.   I will also look into getting httpfox.
0 Kudos
BjornSvensson
Esri Regular Contributor
Yes, FeatureLayer and FeatureService can be confusing, but despite the common first seven letters they are two different things.  On the server you can (in 10), publish a map service as a FeatureService (which requires SDE).  In the API we have a FeatureLayer which can use any (one) layer from either a MapService or FeatureService.  In the viewer, the type="feature" refers to a FeatureLayer and thus can be any (one) layer from either a MapService or a FeatureService.

Note also the difference between a type="dynamic" and a type="feature".
* The dynamic type refers to a full service (behind the scene it is using the ArcGISDynamicMapServiceLayer from the API) and thus its URL should end in "/MapServer".
* The feature type refers to a single layer in a MapService (or FeatureService) (behind the scene it is using the FeatureLayer from the API) and thus its URL should end with a number as in "/MapServer/0".

As for using SimpleInfoWinWidget it only works with single layer, i.e. type="feature".

Hopefully this will help with the understanding of the different types 🙂

As for your initial question, I don't see a "XCoord" field on that layer, try with one of the available fields like "Description", "Category", "Link" etc.
0 Kudos
CattyannCampbell
Frequent Contributor
It helps to let the forum know which version of ArcGIS Server you are using as well, due to the fact that AGS 10 has the "FeatureServer" capability, while 9.3.1 does not have this option.


For Flex 2.0, it really is best to have AGS 10 in my experience, due to the samples ESRI gives use the FeatureServer capability for the InfoPopup samples.


Try switching your type from feature to dynamic if you are not using AGS 10, and it should show up then.


Switching the type from feature to dynamic in 9.3.1 did not work for me. I still get the Zoom Here button....
0 Kudos
CattyannCampbell
Frequent Contributor
So essentially there is no way to do an identify with hyperlink in the Flex SV 2.0 when using Server 9.3
you have to use 10 and specify a feature layer... The only way I get hyperlinks to work with 9.3 is by using the query widget which for some reason highlights my entire layer... in hot pink red... (See attached) How can I get the mother of all highlights to go away. BTW I can get identify to work in this state when I use the InfoPopupWidget.swf instead of the SimpleInfoWinWidget.swf in my config file...
0 Kudos
MLowry
by
Frequent Contributor
So essentially there is no way to do an identify with hyperlink in the Flex SV 2.0 when using Server 9.3
you have to use 10 and specify a feature layer... The only way I get hyperlinks to work with 9.3 is by using the query widget which for some reason highlights my entire layer... in hot pink red... (See attached) How can I get the mother of all highlights to go away. BTW I can get identify to work in this state when I use the InfoPopupWidget.swf instead of the SimpleInfoWinWidget.swf in my config file...


Yes, I also learned recently that essentially there is no way to do an identify in the Flex SV 2.0 when using Server 9.3 without extensive code modification.

The problem I found with using the query widget instead of the identify is that the query can't be done on operational layers, because they query widget has to specify which layer in it's personal config file.

I haven't figured out a good way to do a custom identify on 9.3.1 Server data using operational layers yet. I got it to work fine with the query widget, but using a separate widget for all of the data layers in a map is totally inefficient of course.

Also, I am not sure why all of your polys are red and selected, but does your query have 1=1 at the top of the .xml file like it does as default?? This might be the problem?
0 Kudos