|
POST
|
Looking at examples and seeing two different ways to require dojo. Whats the difference and which one should I be using? Sorry for the green question... dojo.require("esri.map"); dojo.require("esri.layers.FeatureLayer") Or like this var map; require([ "esri/map", "esri/layers/FeatureLayer" ], function( Map, FeatureLayer )
... View more
02-07-2014
05:09 AM
|
0
|
4
|
1692
|
|
POST
|
Have been trying this...think I am closer but would be appreciated if anyone could give some thoughts... need some help pretty bad...did this a bit ago in Silverlight and having issues moving to JS Thanks
//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;
var data = array.map(results.features, function (feature) {
return {
// property names used here match those used when creating the dgrid
"id": feature.attributes[window.outFields[0]],
"Name": feature.attributes[window.outFields[1]],
"Type": feature.attributes[window.outFields[2]]
};
});
var memStore = new dojo.store.Memory({
data: data
});
window.grid.set("store", memStore);
});
});
function sumPopulation(features) {
var popTotal = 0;
for (var x = 0; x < features.length; x++) {
popTotal = popTotal + features .attributes['Number'];
}
return popTotal;
} Then in HTML
<div id="mainWindow" style="width:100%; height:100%;">
<div style="background-color:#EEEEEE;height:100%;width:300px;float:left;">
<table jsid="grid" id="grid">
<thead>
<tr>
<th field="ObjectID" formatter="makeZoomButton" width="25px">
<img alt="+" src="images/flag.png"/>
</th>
<th field="NAME" width="100px">WMA Name</th>
<th field="TYPE" width="100px">Region</th>
</tr>
</thead>
</table>
</div>
<div id="mapDiv" style="background-color:#EEEEEE;height:100%;width:auto;float:left;"></div>
</div>
... View more
02-07-2014
04:04 AM
|
0
|
0
|
2466
|
|
POST
|
Maybe do a for each loop to build an array to pass back the selected records? Confused
... View more
02-06-2014
12:01 PM
|
0
|
0
|
2466
|
|
POST
|
Hi Jay, Here are some samples that has the functionality that you are interested in Buffer and Query https://developers.arcgis.com/javascript/jssamples/query_buffer.html Click on the record in the datagrid, and the appropriate feature gets zoomed and highlighted http://developers.arcgis.com/javascript/samples/fl_zoomgrid/ I hope these samples would give you an idea to move forward. Thanks, Suba Thanks for your help...I was able to get the Buffer and Query working with little issue...now working on trying to get the Results from that Buffer pushed to a Table in my web page (not in the mapDiv itself.) Having some issues with that...could only look at the source code and having issues. Have to some how grab the selected features and put them in an Array and then display the array in HTML? Any further thoughts, hints, examples? Im thinking that I can push teh returned features from within here? But not sure
//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;
var items = dojo.map(featureSet.features,function(feature){
return feature.attributes;
});
var data = {
identifier:"ObjectID",
items:items};
store = new dojo.data.ItemFileReadStore({data:data});
grid.setStore(store);
grid.setSortIndex(1,"true"); //sort on the state name
}); Having some sort of HTML Grid here
<div data-dojo-type="dijit.layout.ContentPane" data-dojo-props="region:'left'" style="width:255px">
<table data-dojo-type="dojox.grid.DataGrid" jsid="grid" id="grid" selectionMode="none">
<thead>
<tr>
<th field="ObjectID" formatter="makeZoomButton" width="25px">
<img alt="+" src="images/flag.png"/>
</th>
<th field="STATE_NAME" width="100px">State</th>
<th field="POP2000" width="100px">Population</th>
</tr>
</thead>
</table>
</div>
... View more
02-06-2014
10:33 AM
|
0
|
0
|
2466
|
|
POST
|
thanks....that was it...similar in Silverlight... Cheers
... View more
01-31-2014
06:08 AM
|
0
|
0
|
2177
|
|
POST
|
In my MapDiv There is a water mark with Sources and Powered By ESRI in the bottom right hand corner Can I remove this? I think I removed it in my Silverlight app but cant remember.... Maybe replace with my own images? [ATTACH=CONFIG]31015[/ATTACH] Thanks
... View more
01-31-2014
06:00 AM
|
0
|
4
|
3728
|
|
POST
|
Thanks Suba....gonna give this a shot over the next few days when time permits...but think I have enough to go on...thank you very much for your thoughts and example locations....very appreciated. Cheers
... View more
01-30-2014
09:31 AM
|
0
|
0
|
2466
|
|
POST
|
I was successful in doing this with a Silverlight application I wrote. Looking to do this in Java Script and looking for some thoughts or examples on how to accomplish it in JS. Click on the map Create Buffer at specified distance Use this buffer to query for features that are in it. Return these results to a table in the HTML page itself. Would be nice to have the ability to hover over a record in that table and have it highlight the feature in the map, and visa versa. I was successful in doing this in silverlight but need to move over to JS Anyone have any examples, thoughts etc? Thanks
... View more
01-30-2014
03:32 AM
|
0
|
8
|
5540
|
|
POST
|
You need to point the proxy to your own. Green here...can you explain that a bit more.... 1. The proxy 2. The app.map reference
... View more
01-28-2014
03:12 AM
|
0
|
0
|
868
|
|
POST
|
anyone know what the app.map reference is....just trying get my app to print.... even copied the code into a new HTML page and the print button didnt show up
... View more
01-27-2014
11:56 AM
|
0
|
0
|
868
|
|
POST
|
I copied and pasted the example from the esri website...I dont get the print button??? Any ideas regarding that for starters....
... View more
01-26-2014
12:52 PM
|
0
|
0
|
868
|
|
POST
|
A little confused. I have been referencing the examples and am putting together a basic Java Script app. I moved to the examples on Printing and am confused with the examples referencing app.map Example: 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
}); All examples up to this point have been like this map = new Map("mapDiv", {
basemap: "topo",
center: [-77.4329, 37.5410],
zoom: 7,
slider: true
});
Can someone help me understand this. I have attached my HTML code and Js page if you need a reference as to how I can incorporate this into my app. Any help would be greatly appreciated.
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<link rel="stylesheet" type="text/css" href="http://js.arcgis.com/3.8/js/esri/css/esri.css">
<!-- Reference the DGIF CSS page -->
<link rel="stylesheet" href="css/dgif.css" media="screen">
<title>PAGE_TITLE</title>
<!-- Reference the js frame work from ESRI-->
<script src="http://js.arcgis.com/3.8/"></script>
<!-- Reference the js page containing all the Java Script code -->
<script type="text/javascript" src="js/test.js"></script>
</head>
<body>
<div id="master-wrapper">
<div id="common-banner">
</div>
<div id="agency-header">
</div>
<div id="wrapper">
<div id="sidebar">
</div>
<div id="content">
<div id="info">
<div id="buttoncontainer";>
<div id="leftcolumn">
<div class="one">
<button id="Point" style="width:130px; height:20px; font-size:13px;">Point</button>
</div>
</div>
<div id="rightcolumn">
<button id="Point" style="width:50px; height:20px; font-size:13px;">Point</button>
</div>
</div>
</div>
<div id="mapDiv"></div>
<div id="info">
<div id="print_button"></div>
<div>
<a href="https://developers.arcgis.com/en/javascript/jsapi/printtemplate.html">Print templates</a> are generated
from the Export Web Map Task's <a href="http://sampleserver6.arcgisonline.com/arcgis/rest/services/Utilities/PrintingTools/GPServer/Export%20Web%20Map%20Task">Layout_Template parameter</a>. This info is retrieved from the service
using <a href="https://developers.arcgis.com/en/javascript/jsapi/namespace_esri.html#request">esri.request</a>.
</div>
</div>
</div>
</div>
<div id="footer">
</div>
</div>
</body>
</html>
var map, tb;
require([
"esri/map", "esri/layers/FeatureLayer", "esri/InfoTemplate", "esri/toolbars/draw",
"esri/symbols/SimpleLineSymbol", "esri/symbols/SimpleFillSymbol",
"esri/renderers/UniqueValueRenderer", "esri/renderers/SimpleRenderer",
"dojo/parser", "dojo/_base/Color", "esri/symbols/SimpleMarkerSymbol",
"esri/arcgis/utils", "esri/symbols/PictureFillSymbol", "esri/symbols/CartographicLineSymbol",
"esri/graphic", "dojo/dom", "dojo/on",
"dijit/layout/BorderContainer", "dijit/layout/ContentPane", "dojo/domReady!"
], function(
Map, FeatureLayer, InfoTemplate, Draw,
SimpleLineSymbol, SimpleFillSymbol,
UniqueValueRenderer, SimpleRenderer,
parser, Color, SimpleMarkerSymbol,
arcgisUtils, PictureFillSymbol, CartographicLineSymbol,
Graphic, dom, on
) {
parser.parse();
map = new Map("mapDiv", {
basemap: "topo",
center: [-77.4329, 37.5410],
zoom: 7,
slider: true
});
map.on("load", initToolbar);
map.on("load", addFeatureLayer);
function addFeatureLayer() {
var defaultSymbol = new SimpleFillSymbol().setStyle(SimpleFillSymbol.STYLE_NULL);
defaultSymbol.outline.setStyle(SimpleLineSymbol.STYLE_NULL);
//create renderer
var renderer = new UniqueValueRenderer(defaultSymbol, "LAKE_NAME");
//add symbol for each possible value
renderer.addValue("LAKE NOTTOWAY", new SimpleFillSymbol().setColor(new Color([255, 0, 0, 0.5])));
var featureLayer = new FeatureLayer("https://fwisweb1.dgif.virginia.gov/arcgis/rest/services/WERMS/WERMS/FeatureServer/8", {
infoTemplate: new InfoTemplate(" ", "${LAKE_NAME}"),
mode: FeatureLayer.MODE_ONDEMAND,
outFields: ["LAKE_NAME"]
});
var featureLayer2 = new FeatureLayer("https://fwisweb1.dgif.virginia.gov/arcgis/rest/services/WERMS/WERMS/FeatureServer/0", {
mode: FeatureLayer.MODE_ONDEMAND,
outFields: ['*']
});
featureLayer.setRenderer(renderer);
map.addLayer(featureLayer);
map.addLayer(featureLayer2);
}
// markerSymbol is used for point and multipoint, see http://raphaeljs.com/icons/#talkq for more examples
var markerSymbol = new SimpleMarkerSymbol();
markerSymbol.setPath("M16,4.938c-7.732,0-14,4.701-14,10.5c0,1.981,0.741,3.833,2.016,5.414L2,25.272l5.613-1.44c2.339,1.316,5.237,2.106,8.387,2.106c7.732,0,14-4.701,14-10.5S23.732,4.938,16,4.938zM16.868,21.375h-1.969v-1.889h1.969V21.375zM16.772,18.094h-1.777l-0.176-8.083h2.113L16.772,18.094z");
markerSymbol.setColor(new Color("#00FFFF"));
// lineSymbol used for freehand polyline, polyline and line.
var lineSymbol = new CartographicLineSymbol(
CartographicLineSymbol.STYLE_SOLID,
new Color([55,77,173,.75]), 1.5,
CartographicLineSymbol.CAP_ROUND,
CartographicLineSymbol.JOIN_MITER, 5
);
// fill symbol used for extent, polygon and freehand polygon, use a picture fill symbol
// the images folder contains additional fill images, other options: sand.png, swamp.png or stiple.png
var fillSymbol = new SimpleFillSymbol(
SimpleFillSymbol.STYLE_SOLID,
new SimpleLineSymbol(
SimpleLineSymbol.STYLE_SOLID,
new Color([55,77,173,0.35]),
2
),
new Color([125,125,125,0.35])
);
// function toolbar
function initToolbar() {
tb = new Draw(map);
tb.on("draw-end", addGraphic);
// event delegation so a click handler is not
// needed for each individual button
on(dom.byId("info"), "click", function(evt) {
if ( evt.target.id === "info" ) {
return;
}
var tool = evt.target.id.toLowerCase();
map.disableMapNavigation();
tb.activate(tool);
});
}
// add graphic
function addGraphic(evt) {
//deactivate the toolbar and clear existing graphics
tb.deactivate();
map.enableMapNavigation();
// figure out which symbol to use
var symbol;
if ( evt.geometry.type === "point" || evt.geometry.type === "multipoint") {
symbol = markerSymbol;
} else if ( evt.geometry.type === "line" || evt.geometry.type === "polyline") {
symbol = lineSymbol;
}
else {
symbol = fillSymbol;
}
map.graphics.add(new Graphic(evt.geometry, symbol));
}
});
... View more
01-26-2014
11:17 AM
|
0
|
5
|
1340
|
|
POST
|
Got it var fillSymbol = new SimpleFillSymbol( SimpleFillSymbol.STYLE_SOLID, new SimpleLineSymbol( SimpleLineSymbol.STYLE_SOLID, new Color([255,0,0,0.35]), 5 ), new Color([125,125,125,0.35]) );
... View more
01-25-2014
11:44 AM
|
0
|
0
|
683
|
|
POST
|
Think I got it...had it all the time Changed width to 5 and changed the color var fillSymbol = new SimpleFillSymbol(
SimpleFillSymbol.STYLE_SOLID,
new SimpleLineSymbol(
SimpleLineSymbol.STYLE_SOLID,
new Color([255,255,255,0.35]),
5
),
new Color([255,0,0,0.35])
);
... View more
01-25-2014
11:41 AM
|
0
|
0
|
683
|
| 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
|