AnsweredAssumed Answered

Set Zoom To Full Extent On Exsisting Graphics On Map Instead of Base Map

Question asked by behClevest on Jan 13, 2017
Latest reply on Jan 18, 2017 by behClevest

Using ArcGIS JavaScript API 3.19, I am simply adding some Point Graphics From a JSON object (Schools)  like below

 

var data = [{
"SCHOOL_NAME": "King George Sec.",
"LATITUDE": 49.2898,
"LONGITUDE": -123.1364,
"ADDRESS": "1755 Barclay St",
"URLLINK": "http://www.vsb.bc.ca/schools/king-george"
}, {
"SCHOOL_NAME": "Britannia Sec.",
"LATITUDE": 49.2752,
"LONGITUDE": -123.0719,
"ADDRESS": "1001 Cotton Drive",
"URLLINK": "http://www.vsb.bc.ca/schools/britannia-secondary"
}, {
"SCHOOL_NAME": "Magee Sec.",
"LATITUDE": 49.2286,
"LONGITUDE": -123.1515,
"ADDRESS": "6360 Maple St",
"URLLINK": "http://www.vsb.bc.ca/schools/magee"
},
....];

 

to the map. now I would like to add a functionality to Zoom to Full Extent of ONLY school points on the Map. Technically I add the `Navigation` class to the Map

 

require(["esri/toolbars/navigation"], function(Navigation) { /* code goes here */ });

and in HTML I have a simple button

 

<button id="show-all-schools">Show All Schools</button>

 

and in JS I have

$("#show-all-schools").on("click", function () {
            navToolbar = new Navigation(map);

            navToolbar
.zoomToFullExtent();
         
});

 

but this is setting the basemap in Full Extent state! Can you please let me know how to pass a parameter like points to zoom to cover entire points instead of basemap?

 

Thanks

Outcomes