Error #1034: Type Coercion Failed - Search widget

499
1
Jump to solution
03-04-2012 03:43 PM
Mohammed_YassineAYACHE
New Contributor III
Hi everybody !

I'm trying to use the search widget (Non-SFV/SV) published by
Robert Scheitlin here.

the problem is when using the rectangle drw tool to make a search request, I get this error :

TypeError: Error #1034: Type Coercion Failed : cannot convert Object@109e12e1 to com.esri.ags.geometry.Geometry


after debugging, I released that the object mentioned in the error (
Object@109e12e1) is an array of Geometry !

so how can I deal with this bug ??
Tags (2)
0 Kudos
1 Solution

Accepted Solutions
RobertScheitlin__GISP
MVP Emeritus
Mohammed,

   So the fix for this issue is to replace this function in the code.

            private function searchDrawEnd(event:DrawEvent):void             {                 event.target.deactivate();                 var geom:Geometry;                 if(event.graphic.geometry is Extent)                     geom = Extent(event.graphic.geometry).toPolygon();                 else                     geom = event.graphic.geometry;                 clearBuffer();                 queryFeaturesGraphical(geom,"esriSpatialRelIntersects",configSearchGraphical[cboLayerGraphical.selectedIndex]);             }


I will update the download on the code gallery soon.

Don't forget to click the Mark as answer check and to click the top arrow (promote) as shown below:

View solution in original post

0 Kudos
1 Reply
RobertScheitlin__GISP
MVP Emeritus
Mohammed,

   So the fix for this issue is to replace this function in the code.

            private function searchDrawEnd(event:DrawEvent):void             {                 event.target.deactivate();                 var geom:Geometry;                 if(event.graphic.geometry is Extent)                     geom = Extent(event.graphic.geometry).toPolygon();                 else                     geom = event.graphic.geometry;                 clearBuffer();                 queryFeaturesGraphical(geom,"esriSpatialRelIntersects",configSearchGraphical[cboLayerGraphical.selectedIndex]);             }


I will update the download on the code gallery soon.

Don't forget to click the Mark as answer check and to click the top arrow (promote) as shown below:
0 Kudos