Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

Can you please take a look at This Demo and let me know how I can set up a custom home button

    var map;
    require(["esri/map", "esri/geometry/Point",
    "esri/symbols/SimpleMarkerSymbol", "esri/symbols/SimpleLineSymbol",
    "esri/graphic", "dojo/dom","dojo/on", "dojo/domReady!"], function (Map, Point,
    SimpleMarkerSymbol, SimpleLineSymbol,
    Graphic, dom, on) {
            map = new Map("map", {
            center: [0, 0],
            zoom: 5,
            basemap: "topo",
            slider: false, // set to false to remove default zoom buttons
            spatialReference: { wkid: 4326 }
        });
        on(dom.byId("zoomInBtn"), "click", function(evt){map.setZoom(map.getZoom()+1);});
        on(dom.byId("zoomOutBtn"), "click", function(evt){map.setZoom(map.getZoom()-1);});
        on(dom.byId("goHome"), "click", function(evt){});
    });
share|improve this question

1 Answer 1

up vote 2 down vote accepted

Your "goHome" function can just use the centerAndZoom function as described in the API documentation. So the code for your function procedure would be:

map.centerAndZoom([0,0],5);
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.