POST
|
In other words, I am trying to create a tool where user will be able to: 1. select a record from featuretable and move the corresponding pt to map click location. This part I working great. 2. After the pt is moved, I would like attributeInspector to open so user can change a value of a column. This is where I am stuck. Any suggestions? Thank you.
... View more
11-17-2015
06:10 AM
|
0
|
1
|
265
|
POST
|
I am trying to move a point of featureservice based on user click but lost on how to use attributeInspector to update a field value for that point. Any ideas or suggestions? Thank you in advance. map.on("click", function(evt){ if (functionMode == "3"){ var selFeatures = flAddressPoints.getSelectedFeatures(); var targetGraphic = selFeatures[0].setGeometry(evt.mapPoint); flAddressPoints.applyEdits(null,[targetGraphic],null,function(feature){ }); } else if (functionMode == "1") { alert("aaa"); } else { //alert("bbb"); } } ); }
... View more
11-16-2015
02:28 PM
|
0
|
2
|
1656
|
POST
|
I am exploring this as starting point for my application. Using FeatureTable (no map) | ArcGIS API for JavaScript How can I access a row/record selected? Examples, I have seen examples refer to evt[0].data.Cmn_Name. I am lost on how do you set up or access data object. Thank you
... View more
10-30-2015
12:04 PM
|
0
|
2
|
2079
|
POST
|
Have you had any luck resolving the issue. I too am struggling to find a solution with the same problem. I tried shortening the file paths (C:\temp). Able to publish directly from ArcGIS Server but not through python code. ERROR 001270: Consolidating the data failed. Failed to execute (StageService). Thanks
... View more
04-11-2014
07:23 AM
|
0
|
1
|
789
|
POST
|
Thank you for your reply - I tried to implement the logic from your example. However I still cannot enable editing - Wondering if you could see where I may be messing up - Thank you in advance - BC
var precURL = "http://Polygons../MapServer"
var addressURL = "http://PointService../FeatureServer/0";
var visibleLayers = [0,1];
var mapTitle = "mymap";
var map, mapLayer, featureLayer, fLayer;
require([
"esri/map",
"esri/dijit/HomeButton",
"esri/geometry/Extent",
"esri/layers/ArcGISDynamicMapServiceLayer",
"esri/layers/FeatureLayer",
"esri/dijit/Scalebar",
"esri/dijit/PopupTemplate",
"esri/dijit/Popup",
"esri/dijit/Geocoder",
"esri/tasks/IdentifyTask",
"esri/tasks/IdentifyParameters",
"esri/tasks/IdentifyResult",
"esri/geometry/screenUtils",
"dojo/_base/array",
"dojo/parser",
"modules/customBasemaps",
"modules/clickLegend",
"dojo/dom",
"dojo/dom-construct",
"esri/config",
"esri/toolbars/edit",
"esri/layers/ArcGISTiledMapServiceLayer",
"esri/symbols/SimpleMarkerSymbol",
"esri/dijit/editing/Editor-all",
"esri/dijit/editing/TemplatePicker",
"esri/config",
"dojo/i18n!esri/nls/jsapi",
"dojo/keys",
"dijit/layout/BorderContainer", "dijit/layout/ContentPane",
"dijit/registry",
"dijit/form/Button",
"dojo/domReady!"
],
function(
Map,
HomeButton,
Extent,
ArcGISDynamicMapServiceLayer,
FeatureLayer,
Scalebar,
PopupTemplate,
Popup,
Geocoder,
IdentifyTask,
IdentifyParameters,
IdentifyResult,
screenUtils,
arrayUtils,
parser,
CustomBasemaps,
ClickLegend,
dom,
domConstruct,
esriConfig,
Edit,
ArcGISTiledMapServiceLayer,
SimpleMarkerSymbol,
Editor,
TemplatePicker,
jsapiBundle,
keys,
registry
) {
parser.parse();
document.title = mapTitle;
esriConfig.defaults.io.proxyUrl = "/proxy";
esriConfig.defaults.geometryService = new esri.tasks.GeometryService("http://tasks.arcgisonline.com/ArcGIS/rest/services/Geometry/GeometryServer");
mapLayer = new ArcGISDynamicMapServiceLayer(precURL);
// Address layer
featureLayer = new FeatureLayer(addressURL,{
mode: FeatureLayer.MODE_ONDEMAND,
outFields: ['*']
});
//labels
var labels = new ArcGISTiledMapServiceLayer("http://server.arcgisonline.com/ArcGIS/rest/services/Reference/World_Boundaries_and_Places/MapServer");
//change in prod
esriConfig.defaults.geometryService = new esri.tasks.GeometryService("http://tasks.arcgisonline.com/ArcGIS/rest/services/Geometry/GeometryServer");
map = new esri.Map("map", {
basemap: "streets",
center: [-79.34, 36.0],
zoom: 10
});
//Legend
var legend = new ClickLegend();
// Send the service url to the "setLayers" method of ClickLegend to create the legend.
legend.setLayers([precURL]);
var basemapGallery = new CustomBasemaps({
showArcGISBasemaps: false,
map: map
}, "basemapMenu");
basemapGallery.startup();
// Set functions to occur once the map has loaded.
map.on("load", function(){
// Using ESRI module, add a scale bar to the map. CSS style can be modified in layout.css.
var scalebar = new Scalebar({
map:map,
scalebarUnit:"english"
});
//Home button
var home = new HomeButton({
map: map
}, "HomeButton");
home.startup();
var search = new Geocoder({
map:map
}, "search");
search.startup();
var layerDefinitions = [];
layerDefinitions[0] = "COUNTY_ID = 1";
layerDefinitions[1] = "COUNTY_ID = 1";
mapLayer.setLayerDefinitions(layerDefinitions);
// Add the layer to the map.
map.addLayers([mapLayer,labels,featureLayer]);
// Set the visible layers using the visibleLayers variable.
mapLayer.setVisibleLayers(visibleLayers);
//editing
registry.forEach(function(d) {
// d is a reference to a dijit
// could be a layout container or a button
alert("test1");
if ( d.declaredClass == "dijit.form.Button" ) {
alert("test");
if (d.value === "startEditing"){
alert("aaa");
d.on("click",initEditor);
}
else if (d.value==="stopEditing"){
alert("bbb")
d.on("click",stopEditing1);
}
else{
return;
}
}
});
});
functionMode = true;
map.on("click", function (evt) {
if (functionMode == true) {
//alert(dom.byId("startEditing").value);
executeIdentifyTask(evt)
} else {
return
}
})
//First create the identifyTask and identifyParameters variables. Then set the identifyParameters properties.
// Set identifyTask to run when the map is clicked.
var identifyTask = new IdentifyTask(precURL);
var identifyParams = new IdentifyParameters();
identifyParams.tolerance = 3;
identifyParams.returnGeometry = true;
identifyParams.layerOption = esri.tasks.IdentifyParameters.LAYER_OPTION_VISIBLE;
identifyParams.width = map.width;
identifyParams.height = map.height;
function executeIdentifyTask(evt) {
// Create a variable to hold the clicked point on the map.
var clickPnt = evt.mapPoint;
identifyParams.geometry = clickPnt;
identifyParams.mapExtent = map.extent;
identifyParams.layerIds = mapLayer.visibleLayers;
//identifyParams.layerIds = [0,1];
// Execute the identifyTask, which will return an array of popup templates to be stored in the "deferred" variable.
var deferred = identifyTask.execute(identifyParams);
deferred.addCallback(function(response) {
// The idenitifyTask returns an array of identify result objects
// This callback function is used to change it to an array of features each with
// a popup template based on the attribute fields for each feature.
return dojo.map(response, function(result) {
var feature = result.feature;
var fieldInfo = [];
for (var key in feature.attributes){
if (feature.attributes.hasOwnProperty(key)){
var info = {fieldName:"", visible:true};
info.fieldName = key;
fieldInfo.push(info);
}
};
feature.setInfoTemplate(new PopupTemplate({
title: result.layerName,
fieldInfos: fieldInfo
}));
return feature;
});
});
// InfoWindow expects an array of features from each deferred
// object that you pass. If the response from the task execution
// above is not an array of features, then you need to add a callback
// like the one above to post-process the response and return an
// array of features.
// Set the infoWindow features to the array stored in the "deferred" variable.
map.infoWindow.setFeatures([ deferred ]);
// Set the anchor point for the infoWindow to the clicked point.
map.infoWindow.show(clickPnt);
//});
}
//editor
//map.on("layers-add-result", initEditor);
function initEditor() {
alert ("initEditor");
functionMode = false;
var templateLayers = arrayUtils.map(evt.layers, function(result){
return result.layer;
});
var templatePicker = new TemplatePicker({
featureLayers: templateLayers,
grouping: true,
rows: "auto",
columns: 1
}, "templateDiv");
templatePicker.startup();
var layers = arrayUtils.map(evt.layers, function(result) {
//alert(result.layer.name);
return { featureLayer: result.layer };
});
var settings = {
map: map,
templatePicker: templatePicker,
//geometryService:geometryService,
layerInfos: layers
};
var params = {settings: settings};
var myEditor = new Editor(params,"templateDiv");
//define snapping options
myEditor.startup();
}
/*
function initEditor() {
alert("initEditor");
map.graphics.clear();
functionMode = false;
templatePicker = new TemplatePicker({
featureLayers: [featureLayer]
}, "templateDiv");
templatePicker.startup();
var layers = [{
featureLayer: featureLayer
}];
var settings = {
map: map,
templatePicker: templatePicker,
layerInfos: layers,
toolbarVisible: true,
createOptions: {
polygonDrawTools: [Editor.CREATE_TOOL_FREEHAND_POLYGON,
Editor.CREATE_TOOL_CIRCLE,
Editor.CREATE_TOOL_RECTANGLE]
},
toolbarOptions: {
reshapeVisible: true
}
};
var params = {
settings: settings
};
myEditor = new Editor(params, 'templateDiv');
myEditor.startup();
};
*/
function stopEditing() {
alert("stop editing..");
templatePicker.destroy();
myEditor.destroy();
dojo.create("div", {
id: "templateDiv"
},"cpTemplate");
functionMode = true;
}
}
);
... View more
02-14-2014
11:22 AM
|
0
|
0
|
1105
|
POST
|
I am trying to combine two scripts that I found on esri.com into one script - 1. identify two mapservice layers - "click" event identify task and popups - works well. 2. edit a featureservice layer using - "layers-add-result" event and template picker - doesn't work. I would like to have the application to do the following - 1. when clicked on a feature from mapservice (polygons) the identify poppup window should display results 2. but if clicked on point feature service only the edit functionality should work. points and polygons do overlap. I am just getting my feet wet in esri javascript api. Any help is really appreciated. Thank you! BC
var precURL = "http://server/arcgis/rest/services/Polys/MapServer"
var addressURL = "http://server/arcgis/rest/services/Points/FeatureServer/0";
var visibleLayers = [0,1];
var mapTitle = "Address pts";
var map, mapLayer, featureLayer, fLayer;
/*
Define the map application script using "require" to load the necessary modules.
See documentation here: "http://dojotoolkit.org/documentation/tutorials/1.8/modules/" for more information.
This includes standard ESRI modules as well as custom modules included with the application.
*/
require([
"esri/map",
"esri/dijit/HomeButton",
"esri/geometry/Extent",
"esri/layers/ArcGISDynamicMapServiceLayer",
"esri/layers/FeatureLayer",
"esri/dijit/Scalebar",
"esri/dijit/PopupTemplate",
"esri/dijit/Popup",
"esri/dijit/Geocoder",
"esri/tasks/IdentifyTask",
"esri/tasks/IdentifyParameters",
"esri/tasks/IdentifyResult",
"esri/geometry/screenUtils",
"dojo/_base/array",
"dojo/parser",
"modules/customBasemaps",
"modules/clickLegend",
"dojo/dom",
"dojo/dom-construct",
"esri/config",
"esri/toolbars/edit",
"esri/layers/ArcGISTiledMapServiceLayer",
"esri/symbols/SimpleMarkerSymbol",
"esri/dijit/editing/Editor-all",
"esri/dijit/editing/TemplatePicker",
"esri/config",
"dojo/i18n!esri/nls/jsapi",
"dojo/keys",
"dijit/layout/BorderContainer", "dijit/layout/ContentPane",
"dojo/domReady!"
],
function(
Map,
HomeButton,
Extent,
ArcGISDynamicMapServiceLayer,
FeatureLayer,
Scalebar,
PopupTemplate,
Popup,
Geocoder,
IdentifyTask,
IdentifyParameters,
IdentifyResult,
screenUtils,
arrayUtils,
parser,
CustomBasemaps,
ClickLegend,
dom,
domConstruct,
esriConfig,
Edit,
ArcGISTiledMapServiceLayer,
SimpleMarkerSymbol,
//SimpleLineSymbol,
Editor,
TemplatePicker,
jsapiBundle,
keys
) {
parser.parse();
// Set the document (webpage) title.
document.title = mapTitle;
// refer to "Using the Proxy Page" for more information: https://developers.arcgis.com/en/javascript/jshelp/ags_proxy.html
esriConfig.defaults.io.proxyUrl = "/proxy";
// Create a dynamic map service layer object using the global mapLayer variable.
mapLayer = new ArcGISDynamicMapServiceLayer(precURL);
// Address layer
featureLayer = new FeatureLayer(addressURL,{
mode: FeatureLayer.MODE_ONDEMAND,
outFields: ['*']
});
//labels
var labels = new ArcGISTiledMapServiceLayer("http://server.arcgisonline.com/ArcGIS/rest/services/Reference/World_Boundaries_and_Places/MapServer");
//change in prod
esriConfig.defaults.geometryService = new esri.tasks.GeometryService("http://tasks.arcgisonline.com/ArcGIS/rest/services/Geometry/GeometryServer");
// Set a variable to the extent with the desired spatial reference.
// Create the map variable with basemap, extent, and minScale.
map = new esri.Map("map", {
basemap: "streets",
center: [-70.34, 30.0],
zoom: 10
});
//Legend
var legend = new ClickLegend();
// Send the service url to the "setLayers" method of ClickLegend to create the legend.
legend.setLayers([precURL]);
// Use the custom basemap module to create create a basemap gallery with the desired basemap layers.
// The layers can be changed by editing the code in the "customBasemaps.js" module.
var basemapGallery = new CustomBasemaps({
showArcGISBasemaps: false,
map: map
}, "basemapMenu");
basemapGallery.startup();
// refer to "Using the Proxy Page" for more information: https://developers.arcgis.com/en/javascript/jshelp/ags_proxy.html
//esriConfig.defaults.io.proxyUrl = "/proxy";
// Set functions to occur once the map has loaded.
map.on("load", function(){
// Using ESRI module, add a scale bar to the map. CSS style can be modified in layout.css.
var scalebar = new Scalebar({
map:map,
scalebarUnit:"english"
});
//Home button
var home = new HomeButton({
map: map
}, "HomeButton");
home.startup();
// Using ESRI module, add a new geocoder search widget. CSS style can be modified in layout.css.
var search = new Geocoder({
map:map
}, "search");
search.startup();
// Set legal disclaimer language.
//alert("This GIS data product to be used for reference purposes only and is not to be construed as a legal document.");
var layerDefinitions = [];
layerDefinitions[0] = "COUNTY_ID = 1";
layerDefinitions[1] = "COUNTY_ID = 1";
mapLayer.setLayerDefinitions(layerDefinitions);
// Add the layer to the map.
map.addLayers([mapLayer,labels,featureLayer]);
// Set the visible layers using the visibleLayers variable.
mapLayer.setVisibleLayers(visibleLayers);
});
// Set identifyTask to run when the map is clicked.
map.on("click", function(evt){
// This code creates the identify functionality when a feature on the map is clicked.
//First create the identifyTask and identifyParameters variables. Then set the identifyParameters properties.
var identifyTask = new IdentifyTask(precURL);
var identifyParams = new IdentifyParameters();
identifyParams.tolerance = 3;
identifyParams.returnGeometry = true;
identifyParams.layerOption = esri.tasks.IdentifyParameters.LAYER_OPTION_VISIBLE;
identifyParams.width = map.width;
identifyParams.height = map.height;
// Create a variable to hold the clicked point on the map.
var clickPnt = evt.mapPoint;
identifyParams.geometry = clickPnt;
identifyParams.mapExtent = map.extent;
identifyParams.layerIds = mapLayer.visibleLayers;
//identifyParams.layerIds = [0,1];
// Execute the identifyTask, which will return an array of popup templates to be stored in the "deferred" variable.
var deferred = identifyTask.execute(identifyParams);
deferred.addCallback(function(response) {
// The idenitifyTask returns an array of identify result objects
// This callback function is used to change it to an array of features each with
// a popup template based on the attribute fields for each feature.
return dojo.map(response, function(result) {
var feature = result.feature;
var fieldInfo = [];
for (var key in feature.attributes){
if (feature.attributes.hasOwnProperty(key)){
var info = {fieldName:"", visible:true};
info.fieldName = key;
fieldInfo.push(info);
}
};
feature.setInfoTemplate(new PopupTemplate({
title: result.layerName,
fieldInfos: fieldInfo
}));
return feature;
});
});
// InfoWindow expects an array of features from each deferred
// object that you pass. If the response from the task execution
// above is not an array of features, then you need to add a callback
// like the one above to post-process the response and return an
// array of features.
// Set the infoWindow features to the array stored in the "deferred" variable.
map.infoWindow.setFeatures([ deferred ]);
// Set the anchor point for the infoWindow to the clicked point.
map.infoWindow.show(clickPnt);
});
//editor
map.on("layers-add-result", initEditor);
function initEditor(evt) {
var templateLayers = arrayUtils.map(evt.layers, function(result){
return result.layer;
});
var templatePicker = new TemplatePicker({
featureLayers: templateLayers,
grouping: true,
rows: "auto",
columns: 1
}, "templateDiv");
templatePicker.startup();
var layers = arrayUtils.map(evt.layers, function(result) {
//alert(result.layer.name);
return { featureLayer: result.layer };
});
var settings = {
map: map,
templatePicker: templatePicker,
//geometryService:geometryService,
layerInfos: layers
};
var params = {settings: settings};
var myEditor = new Editor(params,"editorDiv");
//define snapping options
myEditor.startup();
}
}
);
... View more
02-11-2014
06:22 PM
|
0
|
8
|
8704
|
POST
|
I am dealing with similar issue - IdentifyTask using Popup template on two dynamicservicelayers and editing a feature layer using TemplatePicker. IdentifyTask works but I cannot get editing part work. Please post if you have found a solution. Tnx.
... View more
02-11-2014
12:05 PM
|
0
|
0
|
135
|
POST
|
I have records stuck in Adds, Deletes table. Just default version only no other versions at this time. I can see the updates that I made both in versioned View and ArcMap as well but not when querying the base table in SQL Management studio query. Compress status is successful every time but the updated records can not be seen in SQL since the delta table is not empty. Any suggestions? Thank you in advance.
... View more
10-30-2013
01:13 PM
|
0
|
1
|
650
|
POST
|
Thank you! Here's my final script:
import arcgisscripting
import sys
import fileinput
import os
import string
gp = arcgisscripting.create(9.3)
gp.OverWriteOutput = 1
dbfFileA = "c:\\d_drive\\temp\\listFC.dbf"
#insert cursor
#
rows = gp.InsertCursor(dbfFileA)
try:
for root, dirs, files in os.walk("C:/D_Drive/temp"):
for file in files:
if file.endswith(".shp"):
#print "a"
path = os.path.abspath(os.path.join(root, file))
#print path
row = rows.NewRow()
row.Name = os.path.basename(path)
row.Location = path
row.Directory = os.path.basename(os.path.dirname(path))
row.Type = "Shapefile"
rows.InsertRow(row)
elif file.endswith("gdb"):
#print "1"
path = os.path.abspath(os.path.join(root, file))
#print path
row = rows.NewRow()
#row.Name = os.path.dirname(path)
row.Name = os.path.basename(os.path.dirname(path))
#row.Name = "gdb"
row.Location = os.path.dirname(path)
row.Directory = os.path.basename(os.path.dirname(path))
row.Type = "File Geodatabase"
rows.InsertRow(row)
elif file.endswith(".mdb"):
#print "3"
path = os.path.abspath(os.path.join(root, file))
#print path
row = rows.NewRow()
row.Name = os.path.basename(path)
row.Location = path
row.Directory = os.path.basename(os.path.dirname(path))
row.Type = "Personal Geodatabase"
rows.InsertRow(row)
elif file.endswith("prj.adf"):
#print "4"
path = os.path.abspath(os.path.join(root, file))
row = rows.NewRow()
row.Name = os.path.basename(os.path.dirname(path))
row.Location = os.path.dirname(path)
row.Directory = os.path.basename(os.path.dirname(path))
row.Type = "ArcInfo Coverage"
rows.InsertRow(row)
del rows
print "successful"
except:
print "Error"
print gp.getmessages()
... View more
10-18-2011
04:47 AM
|
0
|
0
|
379
|
POST
|
Thanks for your reply. I am working on a script that would list all .shp and .mdb files on file server into a dbf file. What I would like is to do is add our old arcinfo coverages on the server to this list. import arcgisscripting import sys import fileinput import os import string gp = arcgisscripting.create(9.3) gp.OverWriteOutput = 1 dbfFileA = "c:\\d_drive\\temp\\listFC.dbf" #insert cursor # rows = gp.InsertCursor(dbfFileA) try: for root, dirs, files in os.walk("K:/fish/chpp"): for file in files: if file.endswith(".shp") or file.endswith(".mdb"): path = os.path.abspath(os.path.join(root, file)) #print path row = rows.NewRow() row.Name = os.path.basename(path) row.Location = path rows.InsertRow(row) del rows print "successful" except: print "Error" print gp.getmessages()
... View more
10-12-2011
06:04 AM
|
0
|
0
|
379
|
POST
|
Any ideas on how to get a list of arcinfo coverages and personal/file geodatabases as well? Thank you in advance.
... View more
10-11-2011
12:28 PM
|
0
|
0
|
379
|
POST
|
I think EDN License allows for dev and testing only. For production, you may have buy the complete license.
... View more
07-18-2011
12:38 PM
|
0
|
0
|
264
|
Online Status |
Offline
|
Date Last Visited |
11-11-2020
02:23 AM
|