POST
|
so there is something wrong with this dataframe, that it seems i cant see. SOURCE Change SHAPE 1 file_c -0.29 {'rings': [[[1788402.41, 13301439.29... 2 file_c -0.24 {'rings': [[[1788428.41, 13301463.29... 5 file_c -0.24 {'rings': [[[1788447.41, 13301429.29... When i try to write this to a featureclass df.spatial.to_featureclass(r"C:\tmp\sample.shp") I get IndexError: only integers, slices (`:`), ellipsis (`...`), numpy.newaxis (`None`).... What am i missing with this dataframe?
... View more
10-09-2019
09:52 AM
|
0
|
5
|
1145
|
POST
|
I am drawing a circle radius at one mile and selecting all features that fall within the circle. I want to highlight the selected features and show them in a data grid/ table, and as i click around the map, to update the table along with the selected features. I am able to draw the circle and select the features. i'm also able to console.log the output, but can't figure out how to create the datagrid thats tied the the selected records and clear the table on each new selection. <!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>Buffer</title>
<link rel="stylesheet" href="http://js.arcgis.com/3.11/dijit/themes/tundra/tundra.css">
<link rel="stylesheet" href="http://js.arcgis.com/3.11/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;
}
#drop {
background-color: #fff;
box-shadow: 0 0 5px #888;
font-size: 1.1em;
max-width: 15em;
padding: 0.5em;
position: absolute;
right: 20px;
top: 105px;
z-index: 40;
}
</style>
<script src="http://js.arcgis.com/3.11/"></script>
<script>
var map;
require([
"esri/map", "esri/layers/FeatureLayer",
"esri/tasks/query", "esri/geometry/Circle", "esri/units",
"esri/graphic", "esri/InfoTemplate", "esri/symbols/SimpleMarkerSymbol",
"esri/symbols/SimpleLineSymbol", "esri/symbols/SimpleFillSymbol", "esri/renderers/SimpleRenderer",
"esri/config", "esri/Color", "dojo/dom", "dijit/form/ComboBox", "dojo/domReady!"
], function (
Map, FeatureLayer,
Query, Circle, Units,
Graphic, InfoTemplate, SimpleMarkerSymbol,
SimpleLineSymbol, SimpleFillSymbol, SimpleRenderer,
esriConfig, Color, dom
) {
// use a proxy page if a URL generated by this page is greater than 2000 characters
//
// this should not be needed as nearly all query & select functions are performed on the client
esriConfig.defaults.io.proxyUrl = "/proxy/";
map = new Map("mapDiv", {
basemap: "streets",
center: [-81.00, 34.000],
zoom: 14,
slider: false
});
//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", {
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,
6,
new SimpleLineSymbol(
SimpleLineSymbol.STYLE_NULL, new Color([200, 120, 101, 0.9]), 1),
new Color([200, 0, 0, 1])
);
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;
//when the map is clicked create a buffer around the click point of the specified distance.
map.on("click", function (evt) {
selbuf = document.FormSelection.BufferSelection.selectedIndex;
var BufferSelection = document.FormSelection.BufferSelection.options[selbuf].value;
circle = new Circle({
center: evt.mapPoint,
geodesic: true,
radius: BufferSelection,
radiusUnit: Units.MILES
});
map.graphics.clear();
map.infoWindow.hide();
var graphic = new Graphic(circle, circleSymb);
map.graphics.add(graphic);
var query = new Query();
query.geometry = circle;
featureLayer.selectFeatures(query, FeatureLayer.SELECTION_NEW, function (results) {
console.log(results)
var features = results.features;
console.log(features)
});
});
});
</script>
</head>
<body>
<span id="messages">Click on the map to select by radius within mile.</span>
<span id="drop"> Select Radius Size
<form name="FormSelection">
<select name="BufferSelection">
<option>1</option>
<option>2</option>
<option>10</option>
</select>
</form>
</span>
<div id="mapDiv"></div>
</body>
</html>
... View more
08-12-2019
01:03 PM
|
0
|
2
|
530
|
POST
|
I am looking to use the esri-loader to add mapping functionality to a mobile app that i am building in nativescript, specifically incorporating directions from a road network. has anyone successfully added a map in nativescript?
... View more
12-10-2018
06:07 AM
|
0
|
0
|
471
|
POST
|
try: FC = "c:/temperature/result/atlagint.shp"
arcpy.MakeFeatureLayer_management(FC, newlayer)
arcpy.mapping.AddLayer(df, newlayer, "TOP")
... View more
05-22-2015
05:25 AM
|
0
|
9
|
835
|
POST
|
Glad it works. Python is actually pretty easy to learn, so keep using it and you can do some pretty cool things. nice catch jmward
... View more
05-15-2015
10:17 AM
|
2
|
0
|
423
|
POST
|
If it's the first dataframe then: df = arcpy.mapping.ListDataFrames(mxd)[0] then just use df in your export
... View more
05-15-2015
09:21 AM
|
2
|
1
|
524
|
POST
|
Does your dataframe name match your mxd name? Hardcode the output path and see what happens. outputKML = "C:\\<insert stuff>\myfile.kmz" No you don't need all inputs, if there are any that you are skipping you'll need to account for those like: (stuff1, stuff2, , more stuff, , etc)
... View more
05-15-2015
09:04 AM
|
1
|
1
|
524
|
POST
|
Paste your complete code. Try import os
import arcpy
mxd = arcpy.mapping.MapDocument("CURRENT")
mxdLocation = mxd.filePath
head, tail = os.path.split(mxdLocation)
mxdname = tail.replace(".mxd", "") It seems you are getting there. Edit: had to fix mxdLocation, case on in line 7 to match line 5.
... View more
05-15-2015
08:25 AM
|
1
|
12
|
524
|
POST
|
I normally hardcode values like inputs and outputs until i get everything working, then start adding the variables. I would skip using model builder since you have all the python in the above comments to get it working. I personally have never used it
... View more
05-15-2015
07:20 AM
|
1
|
2
|
596
|
POST
|
As far as getting the file name, i'm not sure of a real elegant way, but i'm sure there is. Perhaps you could use import os
#os.path.split(path)
head, tail = os.path.split("C:/tmp/myfile.mxd")
#head, tail = os.path.split("//tmp/myfile.mxd)
>>>print tail
myfile.mxd or something along those lines. then strip off the mxd. this would work for "/" as well as "\"
... View more
05-14-2015
03:01 PM
|
0
|
0
|
596
|
POST
|
You want the output set like that, not the workspace, i think? and the mxd name should be passed as a string output = "folder1/folder2/folder3/"
mxdname = "mystring"
arcpy.<whatever>(output + mxdname + "/folder4/folder5/";
... View more
05-14-2015
12:59 PM
|
2
|
4
|
930
|
POST
|
It would be for lyr in arcpy.mapping.ListLayers(mxd, "*"):
if lyr.name == "<Feature Name>":
lyr.definitionQuery = '<Field Name> = \'<Field Value>\''
mxd.save() for a shapefile, the format is slightly different
... View more
05-12-2015
04:52 AM
|
1
|
0
|
313
|
POST
|
You could try using a getcount and a if result >1, that should handle if it returns more than one
... View more
05-11-2015
04:55 AM
|
0
|
2
|
245
|
POST
|
I'm not sure if this is causing your problems, but i have had similar errors when my next line runs before the previous line has completed the process.
... View more
05-11-2015
04:51 AM
|
1
|
0
|
845
|
POST
|
You aren't trying to remove the FC, just a value in the symbology, correct? Two simple options would be to either replace the layer file in each mxd with one excluding the the residence value and another option would be to apply definition query to the FC and query out the values. Below will replace a layer file in a directory of mxd's import arcpy
import os
import glob
folder = <folder containing mxds>
layerName = <Existing layer name in mxd's to be replaced>
layerFile = <Layer file containing new symbology>
newLayer = arcpy.mapping.Layer(layerFile)
mxds = glob.glob(folder + '\\' + '*.mxd')
arcpy.gp.overwriteOutput = True
for mxdFile in mxds:
mxd = arcpy.mapping.MapDocument(mxdFile)
for df in arcpy.mapping.ListDataFrames(mxd):
for lyr in arcpy.mapping.ListLayers(mxd, data_frame=df):
if lyr.name == layerName:
arcpy.mapping.UpdateLayer(df, lyr, newLayer, False)
mxd.save()
del mxd, newLayer hope this helps
... View more
05-11-2015
04:48 AM
|
2
|
2
|
313
|
Title | Kudos | Posted |
---|---|---|
1 | 09-12-2022 10:15 AM | |
1 | 05-11-2015 04:51 AM | |
1 | 04-01-2015 06:17 AM | |
1 | 05-15-2015 09:04 AM | |
1 | 05-12-2015 04:52 AM |
Online Status |
Offline
|
Date Last Visited |
03-05-2024
09:40 AM
|