|
POST
|
Confused here...working on integrating a couple examples... one references map and the other one app.map https://developers.arcgis.com/javascript/jssamples/widget_print_esri_request.html app.map = new esri.Map("map", { basemap: "hybrid", center: [-117.447, 33.906], zoom: 17, slider: false }); https://developers.arcgis.com/javascript/jssamples/widget_basemap.html map = new Map("map", { basemap: "topo", center: [-105.255, 40.022], zoom: 13 }); I have the example with app.map working () but I then try and bring in the Basemap gallery and that one only has map referenced...how do I modify this to work THE basemap selector appears but when I select a map nothing happens. I tried this var basemapGallery = new BasemapGallery({ showArcGISBasemaps: true, app.map: map }, "basemapGallery"); basemapGallery.startup(); var basemapGallery = new BasemapGallery({ showArcGISBasemaps: true, map: map }, "basemapGallery"); basemapGallery.startup(); basemapGallery.on("error", function(msg) { console.log("basemap gallery error: ", msg); }); var map; var app = {}; require([ "dojo/ready", "dojo/on", "dojo/_base/connect", "dojo/dom", "dojo/dom-construct", "dojo/parser", "dijit/registry", "esri/layers/FeatureLayer", "esri/layers/ArcGISDynamicMapServiceLayer", "esri/InfoTemplate", "esri/renderers/UniqueValueRenderer", "esri/renderers/SimpleRenderer", "esri/symbols/SimpleMarkerSymbol", "esri/symbols/SimpleLineSymbol", "dijit/layout/BorderContainer", "dijit/layout/ContentPane", "esri/map", "esri/dijit/BasemapGallery", "esri/request", "esri/config", "dojo/_base/array", "esri/dijit/Print", "esri/tasks/PrintTemplate", "esri/arcgis/utils", "esri/domUtils", "esri/dijit/Popup", "dojo/domReady!" ], function( ready, on, connect, dom, domConstruct, parser, registry, FeatureLayer, ArcGISDynamicMapServiceLayer, InfoTemplate, UniqueValueRenderer, SimpleRenderer, SimpleMarkerSymbol, SimpleLineSymbol, BorderContainer, ContentPane, Map, BasemapGallery, esriRequest, esriConfig, arrayUtils, Print, PrintTemplate, arcgisUtils, domUtils, Popup ) { //ready(function(){ parser.parse(); //setup event handlers for the next/previous buttons on(dom.byId("previous"), "click", selectPrevious); on(dom.byId("next"), "click", selectNext); esri.config.defaults.io.proxyUrl = "https://junk.gov/proxypage_net/proxy.ashx"; app.map = new esri.Map("map", { basemap: "topo", center: [-77.4329, 37.5410], zoom: 7, slider: false }); // add graphics for pools with permits var permitUrl = "https://sampleserver6.arcgisonline.com/arcgis/rest/services/PoolPermits/MapServer/1"; var poolFeatureLayer = new FeatureLayer(permitUrl, { mode: FeatureLayer.MODE_SNAPSHOT }); app.map.addLayer(poolFeatureLayer); var TestUrl2 = "https://map.gov/arcgis/rest/services/Map/Map_Readonly/FeatureServer/0"; var FeatureLayer2 = new FeatureLayer(TestUrl2, { mode: FeatureLayer.MODE_SNAPSHOT }); app.map.addLayer(FeatureLayer2); //add the basemap gallery, in this case we'll display maps from ArcGIS.com including bing maps var basemapGallery = new BasemapGallery({ showArcGISBasemaps: true, map: map }, "basemapGallery"); basemapGallery.startup(); basemapGallery.on("error", function(msg) { console.log("basemap gallery error: ", msg); }); });
... View more
03-24-2014
11:54 AM
|
0
|
8
|
1983
|
|
POST
|
THANK YOU!!.... Edit: Something not working still.....will get to ya
... View more
03-24-2014
08:10 AM
|
0
|
1
|
995
|
|
POST
|
thank you....this has been driving me crazy... can you look for the documentation and post here is anyone else is having the same issues. very appreciated.
... View more
03-24-2014
08:03 AM
|
0
|
0
|
995
|
|
POST
|
Hello I am tryring to incorporate a Print funtion into my app from this example https://developers.arcgis.com/javascript/jssamples/widget_print_esri_request.html If I use the example everything works alright....note that I reference my own proxy and printURL I can print The problem arises when I try and add my own feature services. The map and print button appear as expected and the login screen appears as my services are secured. If I add the below The secured login screen appears. I am able to enter my credentials and the Feature Service appears. BUT when I hit the print button is just spins and spins...nothing happens I changed the service name....It seems to be coming from the Service. Can you print Secured services? Does it have to be a Map Service? Thanks var TestUrl = "https://web1.gov/arcgis/rest/services/Map/Map_Readonly/FeatureServer/0";
var FeatureLayer = new FeatureLayer(TestUrl, {
mode: FeatureLayer.MODE_SNAPSHOT
});
app.map.addLayer(FeatureLayer);
... View more
03-24-2014
05:53 AM
|
0
|
6
|
1417
|
|
POST
|
Can I even do this with a FeatureLayer? Seems I would just have to * turn off popups for the Feature Layer * then push the results to the side panel.... but thats the part I cannot figure out...anyone out there give me hand...I can create a JSFiddle if that helps... Here is a JSFiddle...it references a web map....I want to reference a point FC in a service I am hosting...cant figure out how to do this. http://jsfiddle.net/Jaykapalczynski/7uRDF/4/ Points to click are off to the left under the + - zoom buttons... My concern is how to deal with these which are withing the Web Map reference when I remove the web Map and replace with a Feature Layer pointing to a Feature service
window.map = response.map;
//set the popup's popupWindow property to false. This prevents the popup from displaying
map.infoWindow.set("popupWindow", false);
initializeSidebar(window.map);
Thanks
... View more
03-12-2014
05:00 AM
|
0
|
0
|
1652
|
|
POST
|
I can get a general popup to work fine... just cant seem how to transition from WebMap to my Feature class in the example above. How to get the results to the side panel I can see the side panel I can see my features I can click a feature and get a popup But cant figure out how to add the below code snip to the FeatureLayer being added.... map.infoWindow.set("popupWindow", false);
initializeSidebar(window.map);
I see the above in the WebMap from the example in last post.... var map;
require([
"dojo/ready", "dojo/on","dojo/_base/connect", "dojo/dom","dijit/registry","dojo/dom-construct","dojo/parser",
"esri/dijit/Popup","esri/dijit/PopupTemplate", "esri/layers/FeatureLayer",
"esri/layers/ArcGISDynamicMapServiceLayer",
"esri/InfoTemplate",
"esri/renderers/UniqueValueRenderer", "esri/renderers/SimpleRenderer", "esri/symbols/SimpleMarkerSymbol","esri/symbols/SimpleLineSymbol",
"dijit/layout/BorderContainer", "dijit/layout/ContentPane", "esri/map","esri/arcgis/utils","esri/domUtils","esri/dijit/Popup"
], function(
ready, on, connect,dom,registry,domConstruct,parser,
Popup,PopupTemplate, FeatureLayer,
ArcGISDynamicMapServiceLayer,
InfoTemplate,
UniqueValueRenderer,SimpleRenderer,SimpleMarkerSymbol,SimpleLineSymbol,
BorderContainer, ContentPane,Map,arcgisUtils,domUtils,Popup
) {
parser.parse();
//setup event handlers for the next/previous buttons
on(dom.byId("previous"), "click", selectPrevious);
on(dom.byId("next"), "click", selectNext);
map = new Map("mapDiv", {
basemap: "topo",
center: [-77.4329, 37.5410],
zoom: 7,
slider: true
});
var infoTemplate = new InfoTemplate();
infoTemplate.setTitle("Population in ${Species}");
infoTemplate.setContent("<b>2007 :D: </b>${Habitat}<br/>");
//map.on("load", initializeSidebar);
var featureLayer0 = new FeatureLayer("https://web1/arcgis/rest/services/Warbler_Map/Warbler_Map_Readonly/FeatureServer/0", {
mode: FeatureLayer.MODE_ONDEMAND,
infoTemplate: infoTemplate,
outFields: ['*']
});
map.addLayer(featureLayer0);
function initializeSidebar(map){
var popup = map.infoWindow;
//when the selection changes update the side panel to display the popup info for the
//currently selected feature.
connect.connect(popup, "onSelectionChange", function(){
displayPopupContent(popup.getSelectedFeature());
});
//when the selection is cleared remove the popup content from the side panel.
connect.connect(popup, "onClearFeatures", function(){
//dom.byId replaces dojo.byId
dom.byId("featureCount").innerHTML = "Click to select feature(s)";
//registry.byId replaces dijit.byId
registry.byId("leftPane").set("content", "");
domUtils.hide(dom.byId("pager"));
});
//When features are associated with the map's info window update the sidebar with the new content.
connect.connect(popup, "onSetFeatures", function(){
displayPopupContent(popup.getSelectedFeature());
dom.byId("featureCount").innerHTML = popup.features.length + " feature(s) selected";
//enable navigation if more than one feature is selected
popup.features.length > 1 ? domUtils.show(dom.byId("pager")) : domUtils.hide(dom.byId("pager"));
});
}
function displayPopupContent(feature){
if(feature){
var content = feature.getContent();
registry.byId("leftPane").set("content", content);
}
}
function selectPrevious(){
window.map.infoWindow.selectPrevious();
}
function selectNext(){
window.map.infoWindow.selectNext();
}
});
... View more
03-11-2014
10:51 AM
|
0
|
0
|
1652
|
|
POST
|
I am referencing this popup example. Although it shows it consuming an ArcGIS online web map. I want to access my Feature Service. I modified the code to include my Feature Service https://developers.arcgis.com/javascript/jssamples/popup_sidepanel.html The FS shown in code below is not the actual Service...just a junk URL 1. with out the Online Web Map how do I modify this to get the code to run initializeSidebar(window.map); I tried this: map.on("load", initializeSidebar); HTML
<div id="mainWindow" data-dojo-type="dijit/layout/BorderContainer"
data-dojo-props="design:'headline',gutters:false"
style="width:700px; height:400px;">
<div data-dojo-type="dijit/layout/BorderContainer" data-dojo-props="gutters:false"
region="left" style="width: 30%;height:100%;">
<div id="leftPane" data-dojo-type="dijit/layout/ContentPane"
data-dojo-props="region:'center'"></div>
<div id="header2" data-dojo-type="dijit/layout/ContentPane"
data-dojo-props="region:'top'">
<div id="featureCount" style="margin-bottom:5px;">Click to select feature(s)</div>
<div id="pager" style="display:none;">
<a href='javascript:void(0);' id ="previous" class='nav' style="text-decoration: none;">
< Prev
</a>
<a href='javascript:void(0);' id="next" class='nav' style="text-decoration: none;">
Next >
</a>
</div>
</div>
</div>
<div id="mapDiv" data-dojo-type="dijit/layout/ContentPane" data-dojo-props="region:'center'"></div>
</div>
JS
var map;
require([
"dojo/ready", "dojo/on","dojo/_base/connect", "dojo/dom","dijit/registry","dojo/dom-construct","dojo/parser",
"dijit/layout/BorderContainer", "dijit/layout/ContentPane", "esri/map","esri/arcgis/utils","esri/domUtils","esri/dijit/Popup"
], function(
ready, on, connect,dom,registry,domConstruct,parser,
BorderContainer, ContentPane,Map,arcgisUtils,domUtils,Popup
) {
ready(function(){
parser.parse();
//setup event handlers for the next/previous buttons
on(dom.byId("previous"), "click", selectPrevious);
on(dom.byId("next"), "click", selectNext);
map = new Map("mapDiv", {
basemap: "topo",
center: [-77.4329, 37.5410],
zoom: 7,
slider: true
});
map.on("load", initializeSidebar);
var featureLayer2 = new FeatureLayer("https://web1/arcgis/rest/services/Warbler_Map/Warbler_Map_Readonly/FeatureServer/0", {
mode: FeatureLayer.MODE_ONDEMAND,
outFields: ['*']
});
map.addLayer(featureLayer2);
function initializeSidebar(map){
var popup = map.infoWindow;
//when the selection changes update the side panel to display the popup info for the
//currently selected feature.
connect.connect(popup, "onSelectionChange", function(){
displayPopupContent(popup.getSelectedFeature());
});
//when the selection is cleared remove the popup content from the side panel.
connect.connect(popup, "onClearFeatures", function(){
//dom.byId replaces dojo.byId
dom.byId("featureCount").innerHTML = "Click to select feature(s)";
//registry.byId replaces dijit.byId
registry.byId("leftPane").set("content", "");
domUtils.hide(dom.byId("pager"));
});
//When features are associated with the map's info window update the sidebar with the new content.
connect.connect(popup, "onSetFeatures", function(){
displayPopupContent(popup.getSelectedFeature());
dom.byId("featureCount").innerHTML = popup.features.length + " feature(s) selected";
//enable navigation if more than one feature is selected
popup.features.length > 1 ? domUtils.show(dom.byId("pager")) : domUtils.hide(dom.byId("pager"));
});
}
function displayPopupContent(feature){
if(feature){
var content = feature.getContent();
registry.byId("leftPane").set("content", content);
}
}
function selectPrevious(){
window.map.infoWindow.selectPrevious();
}
function selectNext(){
window.map.infoWindow.selectNext();
}
});
});
... View more
03-11-2014
07:15 AM
|
1
|
6
|
7147
|
|
POST
|
Thats exactly what I am trying to achieve although I am not doing an identify but a map click and buffer to query returning results back to a tab control. Any examples of your work? Or a reference of how you did that? I used the standard Grid reference from ESRI JS api but it did not show tabs...I went to a JS page and created one with jQuery but every time I leave that tab and go back my grid vsanishes...sort of confused...would be greatly interested in seeing how you did that if you care to share (JSFiddler)....or at least point me in the direction of an example Appreciate your feedback
... View more
02-24-2014
05:12 AM
|
0
|
0
|
1011
|
|
POST
|
This is how I am creating my grid in JavaScript. Is there a way to encapsulate this grid in a Tab , and have multiple grids, once for each Tab What, if any, are my options to get multiple returns into some sort of Tab controlled window that I can run multiple query's on each map click and return the values to the grids in the Tabs...I can sort of do this but when I click another Tab and go back the grid is gone Thanks // create a dgrid
var sortAttr = [{
attribute: "NAME",
descending: true
}];
grid = new OnDemandGrid({
store: Memory({
idProperty: "NAME"
}),
columns:{
NAME: "SiteNames",
REGION: "Regions",
WATERBODY: "Waterbody",
TYPE: "Type",
ACCESSAREA: "Access",
LOCATION: "Location",
},
sort: sortAttr
}, "grid");
... View more
02-21-2014
11:04 AM
|
0
|
0
|
1011
|
|
POST
|
Any examples out there that return grids to Tabs to contain multiple data returns from multiple queries Any help would be appreciated.
... View more
02-21-2014
07:06 AM
|
0
|
0
|
1011
|
|
POST
|
If there is another way to accomplish this can you shed some light on that...some sort of a tab box that i can feed multiple datasets returns to Basically what I am doing is running a couple queries on the user click, returning 3 sets of data. I want each set to go into each Tab and corresponding Grid in the tab... That make any sense?
... View more
02-20-2014
12:27 PM
|
0
|
0
|
1011
|
|
POST
|
I have a test site that is allowing the user to select a point on the map, it then draws a buffer and selects points inside, then returns those results to a Grid. Everything is working great. Until I tried to move this grid into a Tab driven by jQuery. Initially when I open the page I can see the grid in the first tab, but when I click another tab and go back to the first the Grid is gone... Not sure how I can get the grid back...any thoughts? Not sure why the grid is disappearing jQuery: <script>
;(function($){
$.fn.html5Tabs = function(options){
return this.each(function(index, value){
var obj = $(this),
objFirst = obj.eq(index),
objNotFirst = obj.not(objFirst);
$("#" + objNotFirst.attr("data-toggle")).hide();
$(this).eq(index).addClass("active");
obj.click(function(evt){
toggler = "#" + obj.attr("data-toggle");
togglerRest = $(toggler).parent().find("div");
togglerRest.hide().removeClass("active");
$(toggler).show().addClass("active");
//toggle Active Class on tab buttons
$(this).parent("div").find("a").removeClass("active");
$(this).addClass("active");
return false; //Stop event Bubbling and PreventDefault
});
});
};
}(jQuery));
$(document).ready(function() {
$(".tabs a").html5Tabs();
});
</script> HTML:
<div id="mapDiv">
</div>
<div class="tabs">
<a data-toggle="tab1">Tab1</a>
<a data-toggle="tab2">Tab2</a>
<a data-toggle="tab3">Tab3</a>
</div>
<div class="tabContent">
<div id="tab1">
<h5>Tab1</h5>
<div id="infotab">
<div id="grid" style="Height:250px";></div>
</div>
</div>
<div id="tab2">
<h5>Tab2</h5>
</div>
<div id="tab3">
<h5>Tab3</h5>
</div>
</div> JavaScript:
//SNIP
geometryService.on("buffer-complete", function(result){
map.graphics.clear();
// draw the buffer geometry on the map as a map graphic
var symbol2 = new SimpleFillSymbol(
SimpleFillSymbol.STYLE_NULL,
new SimpleLineSymbol(
SimpleLineSymbol.STYLE_SOLID,
new Color([105,105,105]),
2
),new Color([255,255,0,0.25])
);
var bufferGeometry = result.geometries[0]
var graphic = new Graphic(bufferGeometry, symbol2);
map.graphics.add(graphic);
//Select features within the buffered polygon. To do so we'll create a query to use the buffer graphic
//as the selection geometry.
var query = new Query();
query.geometry = bufferGeometry;
// Select the Points within the Buffer and show them
featureLayer.selectFeatures(query, FeatureLayer.SELECTION_NEW, function(results){
});
// Query for the records with the given object IDs and populate the grid
featureLayer.queryFeatures(query, function (featureSet) {
updateGrid(featureSet);
});
});
function updateGrid(featureSet) {
var data = arrayUtils.map(featureSet.features, function (entry, i) {
return {
NAME: entry.attributes.SITENAME,
REGION: entry.attributes.REGION,
WATERBODY: entry.attributes.WATERBODY,
TYPE: entry.attributes.TYPE,
ACCESSAREA: entry.attributes.ACCESSAREA,
LOCATION: entry.attributes.LOCATION
};
});
grid.store.setData(data);
grid.refresh();
}
... View more
02-20-2014
11:52 AM
|
0
|
6
|
3144
|
|
POST
|
I have been testing some examples from Java Script api help...Right now I have two different HTML pages and each is doing something different. 1. On a user click in the map it buffers an area and then uses that buffer to select records and return to a table. 2. I have an editor that on click in the map it selects the feature and brings up the edit window to edit attributes. What I want is a couple buttons on my page that will run each of the tools above. But I dont want to have to click the button every time, rather click it once and that code will run on each click until the user selects the other tool. Any thoughts or examples? Do I have to encapsulate each tools code in a Function and then have some sort of on button click for each button that runs the JS code? How would I keep that code running until another tool is selected? Thanks
... View more
02-14-2014
11:48 AM
|
0
|
1
|
723
|
|
POST
|
Think I got it.....Seems to be working well....nothing really formatted here just snips of my code. Thank you all for your help, thoughts, and patience....VERY appreciated. The below is doing a few things: When the user clicks the map a buffer is created This buffer is used to select a Point Feature These results are then displayed in the map and the table When you hover over one if the features it displays its attributes. Note there were 3 external CSS files https://js.arcgis.com/3.8/js/dojo/dojox/grid/resources/Grid.css https://js.arcgis.com/3.8/js/esri/css/esri.css http://js.arcgis.com/3.8/js/dojo/dijit/themes/tundra/tundra.css THANK YOU ALL....now on to the next puzzle... 1. Get the Table to jump to the record and highlight it when hover or click the selected features 2. Zoom to the Feature in the map when click on it in the table <body class="tundra">
<div id="grid"></div>
<div id="mapDiv">
<div id="info"></div>
</div>
</body>
var map;
require([
"esri/map", "esri/layers/FeatureLayer",
"esri/tasks/query", "esri/tasks/QueryTask",
"esri/tasks/GeometryService", "esri/tasks/BufferParameters",
"esri/graphic", "esri/InfoTemplate", "esri/symbols/SimpleMarkerSymbol",
"esri/symbols/SimpleLineSymbol", "esri/symbols/SimpleFillSymbol",
"esri/TimeExtent", "dojo/number", "dojo/date/locale",
"dojo/_base/array", "dojo/store/Memory", "dgrid/OnDemandGrid",
"esri/renderers/SimpleRenderer", "esri/lang", "dojo/dom-style", "dijit/TooltipDialog", "dijit/popup",
"esri/config", "dojo/_base/Color", "dojo/dom", "dojo/domReady"
], function(
Map, FeatureLayer,
Query, QueryTask,
GeometryService, BufferParameters,
Graphic, InfoTemplate, SimpleMarkerSymbol,
SimpleLineSymbol, SimpleFillSymbol,
TimeExtent, number, locale,
arrayUtils, Memory, OnDemandGrid,
SimpleRenderer, esriLang, domStyle, TooltipDialog, dijitPopup,
esriConfig, Color, dom
) {
// create a dgrid
var sortAttr = [{
attribute: "SITENAME",
descending: true
}];
grid = new OnDemandGrid({
store: Memory({
idProperty: "SITENAME"
}),
columns:{
NAME: "SiteNames",
REGION: "Regions",
},
sort: sortAttr
}, "grid");
esri.config.defaults.io.proxyUrl = "https://fwisweb1.dgif.virginia.gov/proxypage_net/proxy.ashx";
map = new Map("mapDiv", {
basemap: "streets",
center: [-77.4329, 37.5410],
zoom: 7,
slider: false
});
var featureLayer = new FeatureLayer("https://SOMESERVER/arcgis/rest/services/Test/RampTEST/FeatureServer/0", {
mode: FeatureLayer.MODE_SELECTION,
outFields: ['*']
});
map.infoWindow.resize(245,125);
dialog = new TooltipDialog({
id: "tooltipDialog",
style: "position: absolute; width: 250px; font: normal normal normal 10pt Helvetica;z-index:100"
});
dialog.startup();
// selection symbol used to draw the selected census block points within the buffer polygon
var point = new SimpleMarkerSymbol(
SimpleMarkerSymbol.STYLE_CIRCLE,
25,
new SimpleLineSymbol(
SimpleLineSymbol.STYLE_NULL,
new Color([137, 214, 171, 0.9]),
1
),
new Color([137, 214, 171, 0.5])
);
// Blue new Color([160, 177, 232, 0.5])
// Green new Color([137, 214, 171, 0.9]),
//close the dialog when the mouse leaves the highlight graphic
map.on("load", function(){
map.graphics.enableMouseEvents();
map.graphics.on("mouse-out", closeDialog);
});
//listen for when the onMouseOver event fires on the countiesGraphicsLayer
//when fired, create a new graphic with the geometry from the event.graphic and add it to the maps graphics layer
featureLayer.on("mouse-over", function(evt){
var t = "<b>${SITENAME}</b><hr><b>Region: </b>${REGION}<br>";
var content = esriLang.substitute(evt.graphic.attributes,t);
var highlightGraphic = new Graphic(evt.graphic.geometry,point);
map.graphics.add(highlightGraphic);
dialog.setContent(content);
domStyle.set(dialog.domNode, "opacity", 0.85);
dijitPopup.open({
popup: dialog,
x: evt.pageX,
y: evt.pageY
});
});
function closeDialog() {
map.graphics.clear();
dijitPopup.close(dialog);
}
// selection symbol used to draw the selected census block points within the buffer polygon
var symbol = new SimpleMarkerSymbol(
SimpleMarkerSymbol.STYLE_CIRCLE,
12,
new SimpleLineSymbol(
SimpleLineSymbol.STYLE_NULL,
new Color([247, 34, 101, 0.9]),
1
),
new Color([207, 34, 171, 0.5])
);
featureLayer.setSelectionSymbol(symbol);
// change cursor to indicate features are click-able
featureLayer.on("mouse-over", function () {
map.setMapCursor("pointer");
});
featureLayer.on("mouse-out", function () {
map.setMapCursor("default");
});
// Add the Feature Layer To Map
map.addLayer(featureLayer);
// geometry service that will be used to perform the buffer
var geometryService = new GeometryService("http://tasks.arcgisonline.com/ArcGIS/rest/services/Geometry/GeometryServer");
//when the map is clicked create a buffer around the click point of the specified distance.
map.on("click", function(evt){
//define input buffer parameters
var params = new BufferParameters();
params.geometries = [ evt.mapPoint ];
params.distances = [ 40 ];
params.unit = GeometryService.UNIT_STATUTE_MILE;
geometryService.buffer(params);
});
geometryService.on("buffer-complete", function(result){
map.graphics.clear();
// draw the buffer geometry on the map as a map graphic
var symbol = new SimpleFillSymbol(
SimpleFillSymbol.STYLE_NULL,
new SimpleLineSymbol(
SimpleLineSymbol.STYLE_SHORTDASHDOTDOT,
new Color([105,105,105]),
2
),new Color([255,255,0,0.25])
);
var bufferGeometry = result.geometries[0]
var graphic = new Graphic(bufferGeometry, symbol);
map.graphics.add(graphic);
//Select features within the buffered polygon. To do so we'll create a query to use the buffer graphic
//as the selection geometry.
var query = new Query();
query.geometry = bufferGeometry;
featureLayer.selectFeatures(query, FeatureLayer.SELECTION_NEW, function(results){
var totalPopulation = sumPopulation(results);
var r = "";
r = "<b>The total Census Block population within the buffer is <i>" + totalPopulation + "</i>.</b>";
dom.byId('messages').innerHTML = r;
});
// Query for the records with the given object IDs and populate the grid
featureLayer.queryFeatures(query, function (featureSet) {
updateGrid(featureSet);
});
});
function updateGrid(featureSet) {
var data = arrayUtils.map(featureSet.features, function (entry, i) {
return {
NAME: entry.attributes.SITENAME,
REGION: entry.attributes.REGION
};
});
grid.store.setData(data);
grid.refresh();
}
});
html, body, #mapDiv {
padding: 0;
margin: 0;
height: 100%;
}
#messages{
background-color: #fff;
box-shadow: 0 0 5px #888;
font-size: 1.1em;
max-width: 15em;
padding: 0.5em;
position: absolute;
right: 20px;
top: 20px;
z-index: 40;
}
#grid {
height: 336px;
width: 100%;
}
.field-name {
width: 100px;
font-size: .80em;
font-weight: normal;
}
.field-magnitude {
width: 50px;
font-size: .80em;
font-weight: normal;
}
.field-deaths {
width: 70px;
font-size: .80em;
font-weight: normal;
}
.field-date {
width: 70px;
font-size: .80em;
font-weight: normal;
}
#grid .dgrid-row-odd {
background: #F2F5F9;
}
#info {
background: #fff;
box-shadow: 0 0 5px #888;
left: 1em;
padding: 0.5em;
position: absolute;
top: 1em;
z-index: 40;
}
... View more
02-07-2014
09:05 AM
|
0
|
0
|
2367
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 09-20-2018 11:09 AM | |
| 1 | 09-10-2018 06:26 AM | |
| 1 | 09-15-2022 11:02 AM | |
| 1 | 05-21-2021 07:35 AM | |
| 1 | 08-09-2022 12:39 PM |
| Online Status |
Offline
|
| Date Last Visited |
09-19-2022
09:23 PM
|