Select to view content in your preferred language

Enhanced-Search-Widget-for-FlexViewer Part III

178795
776
04-30-2013 03:58 PM
RobertScheitlin__GISP
MVP Emeritus
All,

   Here is a new thread to post questions and discuss the Enhanched Search Widget. The old thread was getting too long.
Tags (2)
776 Replies
RobertScheitlin__GISP
MVP Emeritus
Bo,

   Once you check the "enable multi-part graphics" checkbox then you will see a search button appears to the right of that chanckbox and then you choose a draw tool and draw on the map (multiple times) and once complete you click the search button.
0 Kudos
BoCastillo
Deactivated User
Bo,

   Once you check the "enable multi-part graphics" checkbox then you will see a search button appears to the right of that chanckbox and then you choose a draw tool and draw on the map (multiple times) and once complete you click the search button.


Robert,

The "search" button does appear but it's not working for me. It will only select using the last graphic drawn. Ironically, if I toggle the buffer on, it will select using all drawn graphics. If it's working for other folks, then I can only assume I botched something up in the code.

Thanks,
Bo
0 Kudos
MichaelMiller2
Frequent Contributor
Robert,

Is it possible to include a caption or title for each link? I have 4 photos looking each way at rail crossings that display fine, but I would like each of them to be labeled (see attachment below). I've gone over the documentation and I'm not seeing anything that will facilitate this. Am I missing something?


Code (snippet of the links area):
                <field name="PicForwardLink" alias="Pic Forward" visible="false"/>
                <field name="PicRightLink" alias="Pic Right" visible="false"/>
                <field name="PicBackLink" alias="Pic Back" visible="false"/>
                <field name="PicLeftLink" alias="Pic Left" visible="false"/>
            </fields>
            <links>
  <link alias="FRA Rail Crossing Site" disablelinksifnull="false" disableinpopups="false">
      <![CDATA[http://safetydata.fra.dot.gov/OfficeofSafety/PublicSite/Crossing/Crossing.aspx]]>
      <icon><![CDATA[assets/images/FRA.png]]></icon>
  </link>
  <link alias="Looking Forward" includeinresults="true" field="PicForwardLink" disablelinksifnull="true" disableinpopups="false" >
      <![CDATA[{PicForwardLink}]]>
      <icon><![CDATA[assets/images/w_link_U.png]]></icon>
  </link>
  <link alias="Looking Right" includeinresults="true" field="PicRightLink" disablelinksifnull="true" disableinpopups="false" >
      <![CDATA[{PicRightLink}]]>
      <icon><![CDATA[assets/images/w_link_R.png]]></icon>
  </link>
  <link alias="Looking Back" includeinresults="true" field="PicBackLink" disablelinksifnull="true" disableinpopups="false" >
      <![CDATA[{PicBackLink}]]>
      <icon><![CDATA[assets/images/w_link_D.png]]></icon>
  </link>
         <link alias="Looking Left" includeinresults="true" field="PicLeftLink" disablelinksifnull="true" disableinpopups="false" >
      <![CDATA[{PicLeftLink}]]>
      <icon><![CDATA[assets/images/w_link_L.png]]></icon>
         </link>                
     </links>



                                                         [ATTACH=CONFIG]25305[/ATTACH]

Thanks for all your great code......
0 Kudos
RobertScheitlin__GISP
MVP Emeritus
0 Kudos
BoCastillo
Deactivated User
Bo,

  Give it a test in the Live Preview Site:

http://gis.calhouncounty.org/FlexViewer3.3/index.html?config=config-eSearch.xml


Robert,

It doesn't work there either! If I click "enable multi-part graphics", try to multiple select on "Traffic Cameras" by drawing two rectangles around two different traffic cameras, it will only select the camera of the last rectangle drawn. If I enable "buffer graphic" and set it to something small, say 2 feet, and draw multiple rectangles, it will select all cameras that I drew multiple rectangles around.

Thanks,
Bo
0 Kudos
RobertScheitlin__GISP
MVP Emeritus
Bo,

   Thanks for reporting this. It use to work just fine so I am not sure which version it broke in...

Update: I have found the issue in the code and it will be fixed in the next version.
0 Kudos
BoCastillo
Deactivated User
Bo,

   Thanks for reporting this. It use to work just fine so I am not sure which version it broke in...

Update: I have found the issue in the code and it will be fixed in the next version.


Robert,

Would it be possible for you to let me know the code that needs fixing? The main reason I'm asking is because I've made quite a bit of customizations to your code to meet our needs.

Thanks,
Bo
0 Kudos
RobertScheitlin__GISP
MVP Emeritus
Bo,

   Sure it is constrained to one function

            /*
            * Function That takes all the graphics in a defined GraphicsLayer and adds unions them into one geometry
            *    @param GraphicsLayer gl is the graphics layer to union
            *    @return Geometry of the unioned graphics
            */
            private function unionGeoms2(gl:GraphicsLayer):Geometry
            {
                var retGeom:Geometry;
                var mPoint:Multipoint = new Multipoint(null);
                mPoint.spatialReference = map.spatialReference;
                var mPoly:Polygon = new Polygon(null);
                mPoly.spatialReference = map.spatialReference;
                var mPolyL:Polyline = new Polyline(null);
                mPolyL.spatialReference = map.spatialReference;
                var rType:String;
                //globals
                var poly:Polygon;
                var ext:Extent;
                var i:int;
                var j:int;
                var mp:MapPoint;
                var ringArray:Array;
                for each (var graphic:Graphic in gl.graphicProvider){
                    if(graphic.geometry.type == "esriGeometryPoint" && !addTolerance.selected){
                        mPoint.addPoint(graphic.geometry as MapPoint);
                        rType = "point";
                    }else if (graphic.geometry.type == "esriGeometryPoint" && addTolerance.selected){
                        ext = createExtentAroundMapPoint(graphic.geometry as MapPoint, pointSearchTolerance) as Extent;
                        poly = ext.toPolygon();
                        for (i = poly.rings.length - 1; i >= 0; i--){
                            ringArray = [];
                            for (j = 0; j < poly.rings.length; j++){
                                mp = poly.getPoint(i,j) as MapPoint;
                                mp.spatialReference = poly.spatialReference;
                                ringArray.push(mp);
                            }
                            mPoly.addRing(ringArray);
                        }
                        rType = "poly";
                        mPoly.spatialReference = poly.spatialReference;
                    }

                    if(graphic.geometry.type == "esriGeometryMultipoint"){
                        var mp1:Multipoint = graphic.geometry as Multipoint
                        var pnts:MapPoint;
                        for (var p:int=0;p < mp1.points.length; p++){
                            mPoint.addPoint(mp1.points
);
                        }
                        rType = "point";
                    }

                    if(graphic.geometry.type == "esriGeometryPolygon"){
                        poly = graphic.geometry as Polygon;
                        for (i = poly.rings.length - 1; i >= 0; i--){
                            ringArray = [];
                            for (j = 0; j < poly.rings.length; j++){
                                mp = poly.getPoint(i,j) as MapPoint;
                                mp.spatialReference = poly.spatialReference;
                                ringArray.push(mp);
                            }
                            mPoly.addRing(ringArray);
                        }
                        rType = "poly";
                        mPoly.spatialReference = poly.spatialReference;
                    }

                    if(graphic.geometry.type == "esriGeometryPolyline"){
                        var polyl:Polyline = graphic.geometry as Polyline;
                        for(var l:int=polyl.paths.length-1; l >= 0; l--){
                            var pathArray:Array = [];
                            for (j = 0; j < polyl.paths.length; j++){
                                mp = polyl.getPoint(l,j) as MapPoint;
                                mp.spatialReference = polyl.spatialReference;
                                pathArray.push(mp);
                            }
                            mPolyL.addPath(pathArray);
                        }
                        rType = "line";
                    }

                    if(graphic.geometry.type == "esriGeometryEnvelope"){
                        ext = graphic.geometry as Extent;
                        poly = ext.toPolygon();
                        for (i = poly.rings.length - 1; i >= 0; i--){
                           ringArray = [];
                            for (j = 0; j < poly.rings.length; j++){
                                mp = poly.getPoint(i,j) as MapPoint;
                                mp.spatialReference = poly.spatialReference;
                                ringArray.push(mp);
                            }
                            mPoly.addRing(ringArray);
                        }
                        rType = "poly";
                        mPoly.spatialReference = poly.spatialReference;
                    }
                }

                switch(rType){
                    case "point":{
                        retGeom = mPoint;
                        break;
                    }
                    case "poly":{
                        retGeom = mPoly;
                        break;
                    }
                    case "line":{
                        retGeom = mPolyL;
                        break;
                    }
                }
                return retGeom;
            }
0 Kudos
BoCastillo
Deactivated User
It works perfectly! Thanks Robert!!!
0 Kudos
ThomasBrophy
Regular Contributor
Robert,
I tried your 3.3.3, but the pulldown is still not populating.  I was able to extract the ArcGIS Server logs for the process in question on both servers. 

First, here is the one that works:
<Msg time='2013-06-10T13:36:31' type='INFO3' code='4006' target='hs_wm.MapServer' machine='xxxxxx' user='UNET\brophyt' thread='7440' elapsed='0.03100'>Server Context created.</Msg>
<Msg time='2013-06-10T13:36:31' type='INFO2' code='100001' target='hs_wm.MapServer' methodName='MapServer.QueryData' machine='xxxxxx' user='UNET\brophyt' process='8364' thread='2536'>String request received. Request size is 173151 characters.</Msg>
<Msg time='2013-06-10T13:36:31' type='INFO2' code='10106' target='hs_wm.MapServer' methodName='MapServer.QueryData' machine='xxxxxx' user='UNET\brophyt' process='8364' thread='2536'>QueryData has started.</Msg>
<Msg time='2013-06-10T13:36:36' type='INFO3' code='10107' target='hs_wm.MapServer' methodName='MapServer.QueryData' machine='xxxxxx' user='UNET\brophyt' process='8364' thread='2536' elapsed='4.38601'>QueryData has completed.</Msg>
<Msg time='2013-06-10T13:36:36' type='INFO2' code='100002' target='hs_wm.MapServer' methodName='MapServer.QueryData' machine='xxxxxx' user='UNET\brophyt' process='8364' thread='2536' elapsed='4.39902'>String request succesfully processed. Response size is 45108 characters.</Msg>
<Msg time='2013-06-10T13:36:36' type='INFO3' code='4007' target='hs_wm.MapServer' machine='xxxxxx' user='UNET\brophyt' thread='4220' elapsed='4.43000'>Server Context released.</Msg>


Here is the one that fails to populate. 
<Msg time='2013-06-10T13:36:31' type='INFO3' code='4006' target='hs_wm.MapServer' machine='yyyyyy' user='?' thread='120460' elapsed='0.01600'>Server Context created.</Msg>
<Msg time='2013-06-10T13:36:31' type='INFO2' code='100001' target='hs_wm.MapServer' methodName='MapServer.QueryData' machine='yyyyyy' user='?' process='121360' thread='121304'>String request received. Request size is 173151 characters.</Msg>
<Msg time='2013-06-10T13:36:31' type='INFO2' code='10106' target='hs_wm.MapServer' methodName='MapServer.QueryData' machine='yyyyyy' user='?' process='121360' thread='121304'>QueryData has started.</Msg> 
<Msg time='2013-06-10T13:36:31' type='ERROR' code='10837' target='hs_wm.MapServer' methodName='MapServer.QueryData' machine='yyyyyy' user='?' process='121360' thread='121304'>Geodatabase error: Logfile not found.</Msg>
<Msg time='2013-06-10T13:36:31' type='ERROR' code='10837' target='hs_wm.MapServer' methodName='MapServer.QueryFeatureData' machine='yyyyyy' user='?' process='121360' thread='121304'>Genaral GeoDatabase Error.</Msg>
<Msg time='2013-06-10T13:36:36' type='INFO3' code='10107' target='hs_wm.MapServer' methodName='MapServer.QueryData' machine='yyyyyy' user='?' process='121360' thread='121304' elapsed='0.22043'>QueryData has completed.</Msg>
<Msg time='2013-06-10T13:36:31' type='ERROR' code='100005' target='hs_wm.MapServer' methodName='MapServer.QueryData' machine='yyyyyy' user='?' process='121360' thread='121304' elapsed='0.23043'>Method failed.HRESULT = 0x80041530 : This is a FACILITY_ITF error that is specific to the interface that returned the error. See documentation of the interface that returned this error for information about this HRESULT.</Msg>
<Msg time='2013-06-10T13:36:36' type='DEBUG' code='100000' target='hs_wm.MapServer' methodName='MapServer.QueryData' machine='yyyyyy' user='?' process='121360' thread='121304'>ERROR INFO = Error processing server request.</Msg>
<Msg time='2013-06-10T13:36:36' type='INFO3' code='4007' target='hs_wm.MapServer' machine='yyyyyy' user='?' thread='118788' elapsed='0.28000'>Server Context released.</Msg>


Do you know what, "Geodatabase error: Logfile not found." on line 4 is about?  Do you know where this log file is located?  Could this be a permissions issue?  I am running out of ideas.

//
I almost forgot.  The first set of logs are from our UNCLAS server, querying hs_wm mapservice who's data resides in ArcSDE on another ORACLE box - it works fine.
The second set of logs are from our CLASS server, querying the same hs_wm mapservice who's data resides in ArcSDE on another ORACLE box - it does not work.  The interesting thing I found out through testing -->  If I export the data being queried into a FGB local to ArcGIS Server - The dropdown works fine.
//

Thanks for your help.


Robert,
I know you are very busy, but just to close the loop on  this issue...  Do you know where the "Logfile not found" could be located?  This may be why the pulldown is still not populating.  Or do you think I should open an incident with the ArcGIS Viewer for Flex Team? 

Thank you again for your time.
0 Kudos