|
POST
|
You may be missing some of the external resources. Try copying the following: <!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <!--The viewport meta tag is used to improve the presentation and behavior of the samples on iOS devices--> <meta name="viewport" content="initial-scale=1, maximum-scale=1,user-scalable=no"> <title>Select with feature layer</title> <link rel="stylesheet" href="http://js.arcgis.com/3.9/js/dojo/dijit/themes/tundra/tundra.css"> <link rel="stylesheet" href="http://js.arcgis.com/3.9/js/esri/css/esri.css"> <style> 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; } </style> <script src="http://js.arcgis.com/3.9/"></script> <script> var map; require([ "esri/map", "esri/layers/FeatureLayer", "dijit/form/ToggleButton", "esri/tasks/query", "esri/geometry/Circle", "esri/graphic", "esri/InfoTemplate", "esri/symbols/SimpleMarkerSymbol", "esri/symbols/SimpleLineSymbol", "esri/symbols/SimpleFillSymbol", "esri/renderers/SimpleRenderer", "esri/config", "esri/Color", "dojo/parser", "dojo/dom", "dojo/on", "dojo/domReady!" ], function( Map, FeatureLayer, ToggleButton, Query, Circle, Graphic, InfoTemplate, SimpleMarkerSymbol, SimpleLineSymbol, SimpleFillSymbol, SimpleRenderer, esriConfig, Color, parser, dom, on ) { esriConfig.defaults.io.proxyUrl = "/proxy"; parser.parse(); map = new Map("mapDiv", { basemap: "streets", center: [-95.249, 38.954], zoom: 14, slider: false }); //add the census block points in on demand mode. Note that an info template has been defined so when //selected features are clicked a popup window will appear displaying the content defined in the info template. var featureLayer = new FeatureLayer("http://sampleserver6.arcgisonline.com/arcgis/rest/services/Census/MapServer/0",{ infoTemplate: new InfoTemplate("Block: ${BLOCK}", "${*}"), outFields: ["POP2000","HOUSEHOLDS","HSE_UNITS", "TRACT", "BLOCK"] }); // 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); //make unselected features invisible var nullSymbol = new SimpleMarkerSymbol().setSize(0); featureLayer.setRenderer(new SimpleRenderer(nullSymbol)); map.addLayer(featureLayer); var circleSymb = new SimpleFillSymbol( SimpleFillSymbol.STYLE_NULL, new SimpleLineSymbol( SimpleLineSymbol.STYLE_SHORTDASHDOTDOT, new Color([105, 105, 105]), 2 ), new Color([255, 255, 0, 0.25]) ); var circle; new ToggleButton({ showLabel: true, onChange: function(val){ if(val == true){ buffer = map.on("click", function(evt){ circle = new Circle({ center: evt.mapPoint, geodesic: true, radius: 1, radiusUnit: "esriMiles" }); map.graphics.clear(); map.infoWindow.hide(); var graphic = new Graphic(circle, circleSymb); map.graphics.add(graphic); var query = new Query(); query.geometry = circle.getExtent(); //use a fast bounding box query. will only go to the server if bounding box is outside of the visible map featureLayer.queryFeatures(query, selectInBuffer); }); this.set('label', 'Clear Buffer'); } else{ map.graphics.clear(); featureLayer.clearSelection(); buffer.remove(); this.set('label', 'Create Buffer'); } }, label: "Create Buffer" }, "buffer"); function selectInBuffer(response){ var feature; var features = response.features; var inBuffer = []; //filter out features that are not actually in buffer, since we got all points in the buffer's bounding box for (var i = 0; i < features.length; i++) { feature = features; if(circle.contains(feature.geometry)){ inBuffer.push(feature.attributes[featureLayer.objectIdField]); } } var query = new Query(); query.objectIds = inBuffer; //use a fast objectIds selection query (should not need to go to the server) 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; }); } function sumPopulation(features) { var popTotal = 0; for (var x = 0; x < features.length; x++) { popTotal = popTotal + features .attributes["POP2000"]; } return popTotal; } }); </script> </head> <body> <span id="messages">Click on the map to select census block points within 1 mile.</span> <div id="mapDiv"> <button id="buffer"></button> </div> </body> </html>
... View more
04-14-2014
11:10 AM
|
0
|
0
|
3673
|
|
POST
|
Here is a helpful link about creating a widget: https://developers.arcgis.com/javascript/jstutorials/intro_custom_dijit.html
... View more
04-14-2014
10:42 AM
|
0
|
0
|
3673
|
|
POST
|
Here is an example you can build off of: http://jsfiddle.net/UjK29/
... View more
04-14-2014
08:25 AM
|
0
|
0
|
3673
|
|
POST
|
Glad this is working. Can you mark this forum as answered? It will further help users in the community.
... View more
04-10-2014
10:12 AM
|
0
|
0
|
2617
|
|
POST
|
Try the following for the Select function: arcpy.SelectLayerByAttribute_management("layer", "NEW_SELECTION", "Layer = '" + name + "'")
... View more
04-10-2014
08:52 AM
|
0
|
0
|
2617
|
|
POST
|
Try the following: import arcpy, sys, os, traceback
from arcpy import env
env.workspace = r"C:\Users\Drew\Desktop\Montpelier\PythonTest\PythonGDB.gdb"
env.overwriteOutput = 1
fc = "dshline_Project"
field = ["Layer"]
valueList = []
#Use search cursor to aquire a list of unique values
with arcpy.da.SearchCursor(fc, field) as cursor:
for row in cursor:
valueList.append(row[0])
uniqueSet = set(valueList)
uniqueList = list(uniqueSet)
uniqueList.sort()
del cursor
count = 0
name = uniqueList[count]
if count < 34:
outputname = env.workspace + os.sep + name
arcpy.MakeFeatureLayer_management (fc, "layer")
arcpy.SelectLayerByAttribute_management("layer", "NEW_SELECTION", "Layer = " + name)
arcpy.CopyFeatures_management("layer", outputname)
count += 1
name = uniqueList[count]
else:
print "Done"
... View more
04-10-2014
08:08 AM
|
0
|
0
|
2617
|
|
POST
|
Hi Tony, You could perform the following steps: 1. Convert the lines vertices to a point feature class using Feature Vertices to Points 2. Add XY Coordinates to point feature class 3. Export feature class to dbf file 4. Rename output dbf file to csv using os.rename
... View more
04-10-2014
07:53 AM
|
0
|
0
|
2205
|
|
POST
|
Hi Adam, It doesn't look like it has. You can check the bugs addressed in the coming 10.2.2 release from the following link: http://downloads.esri.com/support/downloads/other_/1022-IssuesAddressedList.pdf
... View more
04-09-2014
12:09 PM
|
0
|
1
|
1870
|
|
POST
|
Hi Michelle, You won't need a feature class to clip a raster. You can easily enter in the extent in which you need to clip the raster. Be sure you are using the Clip tool in the Data Management toolbox, and not the one in the Analysis toolbox.
... View more
04-08-2014
12:45 PM
|
0
|
0
|
755
|
|
POST
|
I was able to get the issue resolved thanks to Jon Uihlein. He suggested to make the following changes: In default.htm 1) baseMapGallery.js is included twice. Delete the first. 2) Use these ESRI stylesheets: <link rel="stylesheet" type="text/css" href="http://js.arcgis.com/3.8/js/dojo/dijit/themes/claro/claro.css"> <link rel="stylesheet" type="text/css" href="http://js.arcgis.com/3.8/js/esri/css/esri.css"> 3) Change the color of the text on the login panel (it is white on white currently) .esriSignInDialog{ color:#000; } 4) Add class=�?�claro�?� to the body tag In homePage.js Add the following function call to the end of the map onLoad event (line 380~) // place under line: map.setExtent(startExtent); HideProgressIndicator();
... View more
04-08-2014
11:29 AM
|
0
|
0
|
929
|
|
POST
|
Hi Poovalinga, It looks like you are trying to combine the legacy and new AMD modules in the require function. You will want to use one or the other. I would recommend sticking with AMD since the old legacy (dojo.require) module will be deprecated. Also, you will want to execute the dojo/parser. ex: parser.parse(); See this example below: <!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=7, IE=9, IE=10">
<!--The viewport meta tag is used to improve the presentation and behavior of the samples
on iOS devices-->
<meta name="viewport" content="initial-scale=1, maximum-scale=1,user-scalable=no">
<title></title>
<link rel="stylesheet" href="http://js.arcgis.com/3.8/js/dojo/dijit/themes/claro/claro.css">
<link rel="stylesheet" href="http://js.arcgis.com/3.8/js/esri/css/esri.css">
<style>
html, body {
height: 100%; width: 100%;
margin: 0; padding: 0;
}
#map {
height: 100%;
width: 100%;
}
body{
background-color:white; overflow:hidden;
font-family: "Kimberley", sans-serif
}
#header {
-moz-border-radius: 5px;
margin:2px;
padding-top: 4px;
padding-right: 15px;
background-color:#929761;
color:#421b14;
font-size:16pt; text-align:right;font-weight:bold;
border: solid 2px #79663b;
height:55px;
}
#subheader {
font-size:small;
color: #cfcfcf;
text-align:right;
padding-right:20px;
}
#footer {
margin:2px;
padding: 2px;
background-color:white; color:#2a3537;
border: solid 2px #79663b;
font-size:10pt; text-align:center;
height: 30px;
}
#rightPane{
margin:3px;
padding:10px;
background-color:white;
color:#421b14;
border: solid 2px #79663b;
width:20%;
}
#leftPane{
margin:3px;
padding:5px;
width:150px;
color:#3C1700;
background-color:white;
border: solid 2px #79663b;
}
#map {
margin:5px;
border:solid 4px #79663b;
}
.shadow{
-o-border-radius: 6px;
-moz-border-radius: 6px;
-webkit-border-radius: 6px;
box-shadow: 8px 8px 16px #323834;
-webkit-box-shadow: 8px 8px 16px #323834;
-moz-box-shadow: 8px 8px 16px #323834;
-o-box-shadow: 8px 8px 16px #323834;
}
.claro.dijitAccordionText {
margin-left:4px;
margin-right:4px;
color:#5c8503;
}
.panIcon {
background-image: url(images/nav_pan.png);
width: 16px;
height: 16px;
}
.zoominIcon {
background-image: url(images/nav_zoomin.png);
width: 16px;
height: 16px;
}
</style>
<script>var dojoConfig = { parseOnLoad: true };</script>
<script src="http://js.arcgis.com/3.8"></script>
<script>
var map, navToolbar;
require([
"esri/map",
"esri/dijit/Scalebar",
"esri/toolbars/navigation",
"dojo/on",
"dojo/parser",
"dijit/registry",
"dijit/Toolbar",
"dijit/form/Button",
"dijit/layout/BorderContainer",
"dijit/layout/ContentPane",
"dijit/layout/AccordionContainer",
"dojo/domReady!"
],
function (
Map,
Scalebar,
Navigation,
on,
parser,
registry,
Toolbar,
Button
){
parser.parse();
map = new Map("map", {
basemap: "topo",
center: [-118.404, 34.054],
zoom: 11
});
var scale= new Scalebar({
map:map,
attachTo:"bottom-left",
scalebarStyle:"line",
scalebarUnit:"metric"
});
navToolbar = new Navigation(map);
registry.byId("pan").on("click", function () {
navToolbar.activate(Navigation.PAN);
});
registry.byId("Zoomin").on("click", function () {
navToolbar.activate(Navigation.ZOOM_IN);
});
});
</script>
</head>
<body class="claro">
<div id="mainWindow" data-dojo-type="dijit.layout.BorderContainer" data-dojo-props="design:'headline', gutters:false"
style="width:100%; height:100%;">
<div id="header" data-dojo-type="dijit.layout.ContentPane" data-dojo-props="region:'top'">
This is the header section
<div id="subheader">with a subheader</div>
</div>
<div data-dojo-type="dijit.layout.ContentPane" data-dojo-props="region:'left'" id="leftPane">
<div data-dojo-type="dijit.layout.AccordionContainer">
<div data-dojo-type="dijit.layout.ContentPane" data-dojo-props="title:'pane 1'">
Content for pane 1
</div>
<div data-dojo-type="dijit.layout.ContentPane" data-dojo-props="title:'pane 2'">
<p>Content for pane 2</p>
</div>
<div data-dojo-type="dijit.layout.ContentPane" data-dojo-props="title:'pane 3'">
<p>Content for pane 3</p>
</div>
</div>
</div>
<div id="map" class="shadow" data-dojo-type="dijit.layout.ContentPane" data-dojo-props="region:'center'">
<div id="navToolbar" data-dojo-type="dijit.Toolbar" ></div>
<div data-dojo-type="dijit.form.Button" id="pan" data-dojo-props="iconClass:'panIcon'">Pan</div>
<div data-dojo-type="dijit.form.Button" id="Zoomin" data-dojo-props="iconClass:'zoominIcon'">ZoomIn</div>
</div>
<div data-dojo-type="dijit.layout.ContentPane" data-dojo-props="region:'right'" id="rightPane">
This is the right section
</div>
<div id="footer" data-dojo-type="dijit.layout.ContentPane" data-dojo-props="region:'bottom'">
this is the footer section
</div>
</div>
</body>
</html>
... View more
04-08-2014
04:58 AM
|
0
|
0
|
644
|
|
POST
|
Hi Mark, Yes, I set up the proxy page, but still receive the same error. Ex: <?xml version="1.0" encoding="utf-8"?>
<ProxyConfig mustMatch="true">
<serverUrls>
<serverUrl matchAll="true" url="http://<server>/arcgis/rest/services/"></serverUrl>
<serverUrl matchAll="true" url="http://<server>/arcgis/rest/services/"></serverUrl>
</serverUrls>
</ProxyConfig> I also configured the application to always use the proxy in the homepage.js file: esri.config.defaults.io.proxyUrl = "proxy.ashx";
esriConfig.defaults.io.alwaysUseProxy = true; The result is the same whether I set this to 'true' or 'false'.
... View more
04-08-2014
04:11 AM
|
0
|
0
|
929
|
|
POST
|
Hi Gray, Instead of creating the GraphicsLayer each time the showBuffer function is run, you can create it when the map is loaded. You can then use the GraphicsLayer clear method. Here is an example. If this resolves your issue, don't forget to mark this thread as resolved/answered to help other users in the community.
... View more
03-31-2014
12:20 PM
|
0
|
0
|
2680
|
|
POST
|
I'm trying to use a secured service with the Citizen Service Request application. I've added the dojo.require("esri.IdentityManager") to the application as stated in this sample, but I'm never prompted for a username/password. I receive the error: dojo.io.script error Error: Token Required Has anyone successfully added a secure service to this application?
... View more
03-31-2014
10:42 AM
|
0
|
3
|
1585
|
|
POST
|
You can use the following function to report how many points are within each polygon once the map is loaded: var polygonFeature= new FeatureLayer(my feature layer with polygons, { mode: FeatureLayer.MODE_ONDEMAND, outFields: ["*"] }); map.addLayer(polygonFeature); map.on("update-end", function(){ array.forEach(polygonFeature.graphics, function(feature){ var OID = feature.attributes.OBJECTID; var query = new Query(); var queryTask = new QueryTask("url to points"); query.geometry = feature.geometry query.returnGeometry = true; queryTask.executeForCount(query, function(count){ console.log("ObjectID " + OID + " has " + count + " points"); }) }) }) You will need to add the dojo/_base/array module to your code. For adding the text to your map, take a look at the TextSymbol class.
... View more
03-28-2014
03:47 AM
|
0
|
0
|
5311
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 07-08-2026 12:27 PM | |
| 4 | 05-07-2020 05:14 PM | |
| 1 | 03-25-2026 04:16 AM | |
| 1 | 03-16-2026 01:00 PM | |
| 1 | 12-22-2025 10:39 AM |
| Online Status |
Offline
|
| Date Last Visited |
Tuesday
|