zoom to search layer

419
2
10-24-2011 09:15 PM
shwetakunjadia
New Contributor
Hi,

While i m doing  zoom to search layer at that time it will give me javascript error..
although i m able to draw graphics but the next step is zoom to feature is not working...

In case of polygon its working but in case of Point its not working

Error:
TypeError: g.geometry.getExtent() is null

Plz help me........
0 Kudos
2 Replies
JoeJeurissen
New Contributor
Point geometry does not have the method getExtent().

To get the extent of a point one option would be to create your own extent from the x/y coordinates of the point.

if (g.geometry.type == "point")
     new esri.geometry.Extent({"xmin":g.geometry.x - 2000,"ymin":g.geometry.y - 2000,"xmax":g.geometry.x + 2000,"ymax":g.geometry.y + 2000,"spatialReference":{"wkid":g.geometry.spatialReference.wkid}});
else
     g.geometry.getExtent();
0 Kudos
shwetakunjadia
New Contributor
thanks for reply its working....
0 Kudos