var layerObj = new esri.layers.GraphicsLayer({id:"points_glayer", visible:true, opacity:1}); map.addLayer(layerObj); var glayer = map.getLayer("points_glayer");
function pointToExtent(map, point, toleranceInPixel) { //Function to convert a point coordinate into a rectangle area var pixelWidth = map.extent.getWidth() / map.width; var toleraceInMapCoords = toleranceInPixel * pixelWidth; toleraceInMapCoords = 1320; return new esri.geometry.Extent( point.x - toleraceInMapCoords, point.y - toleraceInMapCoords, point.x + toleraceInMapCoords, point.y + toleraceInMapCoords, map.spatialReference ); }
dojo.require("esri.layers.FeatureLayer");
//Listener event for feature selection and the popup info widow dojo.connect(theUsgsLayer,"onClick",function(evt){ //Listener event for feature selection and the popup info widow var query = new esri.tasks.Query(); query.geometry = pointToExtent(map,evt.mapPoint,15); var deferred = theUsgsLayer.selectFeatures(query,esri.layers.FeatureLayer.SELECTION_NEW); map.infoWindow.resize(350,300); map.infoWindow.setFeatures([deferred]); map.infoWindow.show(evt.mapPoint); }); //Listener event for feature selection and the popup info widow dojo.connect(theFloodplainLayer,"onClick",function(evt){ //Listener event for feature selection and the popup info widow var query = new esri.tasks.Query(); query.geometry = pointToExtent(map,evt.mapPoint,15); var deferred = theFloodplainLayer.selectFeatures(query,esri.layers.FeatureLayer.SELECTION_NEW); //map.infoWindow.resize(map.width * 0.70, map.height * 0.6); map.infoWindow.resize(200,175); map.infoWindow.setFeatures([evt.graphic]); map.infoWindow.show(evt.mapPoint); });
Angemeldete Mitglieder können Beiträge verfassen, Updates folgen und mehr. Neu hier? Registriere ein kostenloses Konto.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.