AnsweredAssumed Answered

Full extent  -zoom to Graphic Layer

Question asked by meenu.monu on Sep 20, 2015
Latest reply on Sep 23, 2015 by rscheitlin

After adding graphics trying to zoom map using the code below. But it is giving script error.How to zoom map with all graphics visibility?

    <script type="text/javascript" src="http://serverapi.arcgisonline.com/jsapi/arcgis/?v=2.4">

//ADDING GRAPHICS

           var geomPoint = new esri.geometry.Point(list.d[recordcount].ELon, list.d[recordcount].ELat, new esri.SpatialReference({ wkid: 2278 }));

                            geomPoint = esri.geometry.geographicToWebMercator(geomPoint);

                            var symbol = new esri.symbol.PictureMarkerSymbol({

                                "url": colourstyle,

                                "height": 16,

                                "width": 16,

                                "type": "esriPMS"

                            });

 

                            var infoTemplate = new esri.InfoTemplate();

                            infoTemplate.content = strhotspot;

                            var pointGraphic = new esri.Graphic(geomPoint, symbol);

                            pointGraphic.setInfoTemplate(infoTemplate);

                            graphicsLayer.add(pointGraphic);

 

 

//Getting Extent

 

//var zoomExtent = esri.graphicsExtent(graphicsLayer.graphics);

                //map.setExtent(zoomExtent);

       var lyrExtent = esri.geometry.geographicToWebMercator(esri.graphicsExtent(graphicsLayer.graphics));

 

Outcomes