Created
March 1, 2021 17:45
-
-
Save hhkaos/c3d7939036f74274d758bf516b974909 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| require([ | |
| ... | |
| ], | |
| function( | |
| ... | |
| ){ | |
| on(dojo.byId("pintaYQuery"), "click", function (){ | |
| tb = new Draw(map); | |
| tb.activate(Draw.POLYGON); | |
| tb.on("draw-end",function (evt) { | |
| map.graphics.clear(); | |
| map.graphics.add(new Graphic(evt.geometry, tbSymbolCities)); | |
| var queryCities = new Query(); | |
| queryCities.geometry = evt.geometry; | |
| ftCities.selectFeatures(queryCities, FeatureLayer.SELECTION_NEW, function(g){ | |
| ... | |
| }); | |
| }); | |
| }); | |
| on(dojo.byId("progButtonNode"), "click", function (){ | |
| ftStates.setSelectionSymbol(sbState); | |
| var queryState = new Query(); | |
| queryState.where = `state_name = '${dojo.byId("dtb").value}'`; | |
| ftStates.selectFeatures(queryState, FeatureLayer.SELECTION_NEW, function (selection){ | |
| var centerSt = graphicsUtils.graphicsExtent(selection).getCenter(); | |
| map.centerAt(centerSt); | |
| }); | |
| }); | |
| on(dojo.byId("clear"),"click",function (){ | |
| ftCities.clearSelection(); | |
| map.graphics.clear(); | |
| tb.deactivate() | |
| }); | |
| map = new Map("map", { | |
| basemap: "topo", | |
| extent: extentInitial, //define la extension inical del mapa | |
| zoom: 4, | |
| sliderStyle: "small", | |
| }); | |
| var ftCities = new FeatureLayer("http://sampleserver6.arcgisonline.com/arcgis/rest/services/USA/MapServer/0",{ | |
| outFields:["*"] | |
| }); | |
| var ftStates = new FeatureLayer("http://sampleserver6.arcgisonline.com/arcgis/rest/services/USA/MapServer/2", { | |
| infoTemplate: new PopupTemplate({ | |
| ... | |
| }), //llama la ventana emergente | |
| outFields:["*"] //llama a todos los campos de la capa | |
| }); | |
| map.addLayers([ftStates, ftCities]); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment