my_map.setExtent(esri.graphicsExtent(EDDM_map.graphics.graphics), true);
Yes. Starting with a map with full US as extent, I'm placing 2 graphics on it about 3 miles apart. It zooms to the correct area with the 2 graphics just outside of the view.
// The symbol MapLib.boxSymbol = new esri.symbol.PictureMarkerSymbol({ "type": "esriPMS", "url": "/assets/collection_box.png", "contentType": "image/png", "width": 12, "height": 22, "angle": 0, "xoffset": 0, "yoffset": 11 }); //Add graphic to the map for (var i = 0, il = resultFeatures.length; i < il; i++) { esridojo.forEach(resultFeatures.geometry.points, function(point){ // each resultFeature is a multipoint BoxGraphic = new esri.Graphic(esri.geometry.Point(point), MapLib.boxSymbol); my_map.graphics.add(BoxGraphic); } } // Set the extent my_map.setExtent(esri.graphicsExtent(my_map.graphics.graphics), true);
dojo.toJson(map.getLayer(map.graphicsLayerIds[0]).graphics[0].toJson());
{"geometry":{"x":-10590229.129506975,"y":4802418.958195844,"spatialReference":{"wkid":102100}},"attributes":{"FID":1496,"CITY_FIPS":"02900","CITY_NAME":"Atchison","STATE_FIPS":"20","STATE_NAME":"Kansas","STATE_CITY":"2002900","TYPE":"city","CAPITAL":"N","ELEVATION":810,"POP1990":10656,"HOUSEHOLDS":3877,"MALES":4976,"FEMALES":5680,"WHITE":9557,"BLACK":848,"AMERI_ES":66,"ASIAN_PI":85,"OTHER":100,"HISPANIC":270,"AGE_UNDER5":755,"AGE_5_17":2088,"AGE_18_64":5841,"AGE_65_UP":1972,"NEVERMARRY":2394,"MARRIED":4193,"SEPARATED":76,"WIDOWED":909,"DIVORCED":722,"HSEHLD_1_M":396,"HSEHLD_1_F":768,"MARHH_CHD":978,"MARHH_NO_C":1044,"MHH_CHILD":50,"FHH_CHILD":322,"HSE_UNITS":4267,"VACANT":390,"OWNER_OCC":2620,"RENTER_OCC":1257,"MEDIAN_VAL":31400,"MEDIANRENT":188,"UNITS_1DET":3298,"UNITS_1ATT":38,"UNITS2":223,"UNITS3_9":210,"UNITS10_49":179,"UNITS50_UP":129,"MOBILEHOME":157},"symbol":{"color":[0,0,255,255],"size":12,"angle":0,"xoffset":0,"yoffset":0,"type":"esriSMS","style":"esriSMSCircle","outline":{"color":[0,0,0,255],"width":1,"type":"esriSLS","style":"esriSLSSolid"}}}
Přihlášení členové mohou přispívat, sledovat aktualizace a další. Jste tu noví? Zaregistrujte si bezplatný účet.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.