Select to view content in your preferred language

storing geometry in array

678
2
Jump to solution
01-13-2012 10:05 AM
DebbieAlger
Deactivated User
I want to store geometries in an array but am getting errors retrieving the data. I have done a test on length and it contains objects.

private var geometryArray:Array;
geometryArray = new Array();

for each(var graphic:Graphic in fs.features)
{
               geometryArray.push([graphic.geometry]);
         }
 
later .....   map.extent = geometryArray.extent.expand(3);   ===> ERROR  HERE

Error #1034: Type Coercion failed: cannot convert []@19e9c971 to com.esri.ags.geometry.Geometry.

I have tested with just one instance and it works fine, such as this..

var geom:geometry;

geom =  graphic.geometry;

..... map.extent = geom.extent.expand(3);

______________________________________
so I know the geometry is fine...

any ideas on the array issue??

thanks
Tags (2)
0 Kudos
1 Solution

Accepted Solutions
RobertScheitlin__GISP
MVP Emeritus
Debbie,

   So why are you store the geometry in an array and then adding it to an array?

geometryArray.push([graphic.geometry]); 
???

Try:

geometryArray.push(graphic.geometry);

View solution in original post

0 Kudos
2 Replies
RobertScheitlin__GISP
MVP Emeritus
Debbie,

   So why are you store the geometry in an array and then adding it to an array?

geometryArray.push([graphic.geometry]); 
???

Try:

geometryArray.push(graphic.geometry);
0 Kudos
DebbieAlger
Deactivated User
Well color me silly, that was it.

THanks so much!
0 Kudos