Select to view content in your preferred language

Selection Widget for SFV2.2 (with a query builder)

6924
50
02-21-2011 11:55 AM
MarkHoyland
Frequent Contributor
The Selection widget has a "Select by Attributes" and "Select by Location" option similar to ArcGIS.
It has options where you can set your selection type eg New Selection, Add to Selection, Remove from Selection.
Select from multiple layers that interstect/contain etc another layer.
You can view the results for each layer in a datagrid, and export to tab delimited text file.

Widget link: http://www.arcgis.com/home/item.html?id=20ed6af9ab204548bbf092d51b51fef8

I built this because it seemed like a fun project and the temptation of a Flex a Widget T-shirt was too much to resist.:o

If you download please leave feedback and rate the widgets (this should apply to any widget you download) as the feed back really helps to know what users are after.
Tags (2)
0 Kudos
50 Replies
JeffLegato
Regular Contributor
Mark,
Great widget!  I am in the process of configuring it now and am having trouble getting the results to display in the grid.  I can successfully run a query and zoom to the selected features but my selection results table remains empty although when I hover over the table the information is highlighted on the map and I can click on the table results and the map zooms to that item.  Any ideas? 

Also can I configure an alias for the fields?

Thanks!
0 Kudos
MarkHoyland
Frequent Contributor
Jeff,
"when I hover over the table the information is highlighted on the map"
So you can see the attribute data in the infowindow? Is this for all of your layers or just one.
Is the data you are querying available external so I can have a look.
Could you post your SelectionWidget.xml file.

Alias are net set up for this widget.
0 Kudos
JeffLegato
Regular Contributor
I can see the attribute data in the info widow.  Sorry, this app is internal so I can't share it with you but you can see the screenshot...

https://picasaweb.google.com/lh/photo/MRAgqqb33p2IAU0QMogAXg?feat=directlink

<?xml version="1.0" ?>
<configuration>
    <layers>
        <layer>
            <name>Parcels</name>
            <url>http://pacific/ArcGIS/rest/services/Planning/SLOCO_Parcels_CD_LU/MapServer/0</url>
            <titlefield>SLOCO.SDE.SLO_PARCEL_CD_LU.APN</titlefield>
            <linkfield>SLOCO.SDE.PLN_Tidemark_pmt.link</linkfield>
            <fields>
                  <field name="SLOCO.SDE.SLO_PARCEL_CD_LU.APN"/> 
    <field name="SLOCO.SDE.SLO_PARCEL_CD_LU.ASSESSEE" alias="Assessee"/> 
    <field name="SLOCO.SDE.SLO_PARCEL_CD_LU.C_O"/>
    <field name="SLOCO.SDE.SLO_PARCEL_CD_LU.ADDRESS_1"/>
    <field name="SLOCO.SDE.SLO_PARCEL_CD_LU.CITY"/>
    <field name="SLOCO.SDE.SLO_PARCEL_CD_LU.STATE"/>
    <field name="SLOCO.SDE.SLO_PARCEL_CD_LU.ZIP"/>
    <field name="SLOCO.SDE.PLN_Tidemark_pmt.link"/>
            </fields>
 <infowindowfields>
                   <field name="SLOCO.SDE.SLO_PARCEL_CD_LU.APN"/> 
    <field name="SLOCO.SDE.SLO_PARCEL_CD_LU.ASSESSEE" alias="Assessee"/> 
    <field name="SLOCO.SDE.PLN_Tidemark_pmt.link"/>
   </infowindowfields>
        </layer>
       
    </layers>
    <zoomscale>5000</zoomscale>
    <info>widgets/InfoTemplates/InfoPopupWidget.swf</info>
</configuration>
0 Kudos
DanielOchoa
Regular Contributor
Mark,

I'll echo the previous - great widget....and I see you are sharing Robs code.  Collaboration is one of the keys to success....

Now, just putting it out there....combine the graphical selection tools (circle, square,line, etc) of Rob's eSearch with your query search parameters= perfect search tool!

~ D
0 Kudos
MarkHoyland
Frequent Contributor
Jeff,
I think this might be to do with the fully qualified field names. eg SLOCO.SDE.SLO_PARCEL_CD_LU.APN instead of APN
I am guessing you are doing this because your link field is from a different featureclass?
The intended use is that all the fields come from the same featureclass.(layer in the .xml config)
Your link field should be a field in the SLO_PARCEL_CD_LU layer.
Is the link the same for all parcels or different?

Test out your layer without the link field and without the fully qualified names and see if that works.
0 Kudos
MarkHoyland
Frequent Contributor
Hi Daniel,
The widget is based on the FlexViewer's built in search widget, with the addition of Robert's unionGeom function. That function is brilliant as it is client side and so quick. It is definately worth looking at what others have done and reusing there work (if permitted of course).

I did think about including graphical selection tools but there were a few widgets that already did this sort of thing, so I decided against it.

But yes a select by Graphic option like ArcGIS would be good.
I will see about adding one.
(I am also happy to include contributions and enhancements from others.)
0 Kudos
JeffLegato
Regular Contributor

Test out your layer without the link field and without the fully qualified names and see if that works.


Yep, that did the trick.  Thanks for the help!

That link field is unique but based on the APN so I'll have to experiment a little and see what I can do.

So my suggestions for improvements would be to allow aliases and fully qualified fields so that you can use joined tables.  😉

Seriously though, thanks for all the work you put into these things.  My application would be severely lacking if it were not for people like yourself and Robert.
0 Kudos
MarkHoyland
Frequent Contributor
Sertact(February 24, 2011)
Great widget. Many thanks for the great job. A small question. When make the selection and the results are returned. The results are not displayed at their correct locations on the map. When I double click from the grid it kind of centers the correct location for that record but again all the others are not displayed correctly. My map service and map are at the same datum which is WGS84. One other thing at your SelectionWidgetUtil.as I realized that you add/subtract 5000 to get the graphic extent of the records selected. I think this value is a bit high if one is using Decimal degrees with wgs84 datum. Any suggestions for these. Many thanks again.


Sertact,
The results are returned as a featurelayer which is a direct representation of the GIS data. If it is not in the correct place it sounds like some sort of projection issue?? If you put the base map that you are using with this widget into ArcGIS and overlay your data on top of it, does it line up correctly. Is your data available externally?

The zoom function in SelectionWidgetUtil.as  is copied from one of my other projects which is using projected data. The 5000 was for metres (5 kilometres) So for decimal degrees it would be a bit high. I will update this at some stage (maybe use pan to point xy instead).
0 Kudos
SertaçTAKIL
Deactivated User
Sertact,
The results are returned as a featurelayer which is a direct representation of the GIS data. If it is not in the correct place it sounds like some sort of projection issue?? If you put the base map that you are using with this widget into ArcGIS and overlay your data on top of it, does it line up correctly. Is your data available externally?

The zoom function in SelectionWidgetUtil.as  is copied from one of my other projects which is using projected data. The 5000 was for metres (5 kilometres) So for decimal degrees it would be a bit high. I will update this at some stage (maybe use pan to point xy instead).


Sorry my data is not publicly available. Yes they do line up in ArcGIS. All my service layers are of WGS84 datum with decimal degrees. The strange thing is they are at their right place but the icons that indicate their places are at the wrong place. When I click to a result from the result list it zooms to that feature correctly, and puts the icon to the correct location for that record (and for some others that are close to that feature). But when I pan or zoom in/out I see that the icons for the other results are at the wrong places. Can it be some kind of a refresh issue? I wonder.

That's what I thougt with the zoom issue. no problem with that ridght now.
Thanks for the answer.
0 Kudos