|
POST
|
I figured as much and created them as indicated in the code. Same error.
... View more
02-07-2013
11:39 AM
|
0
|
0
|
1011
|
|
POST
|
1 step closer. Now its telling me: Runtime error Traceback (most recent call last): File "<string>", line 19, in <module> RuntimeError: Cannot find field 'NAME' Does my new table need to have these field names or will it generate them automatically?
... View more
02-07-2013
11:19 AM
|
0
|
0
|
1011
|
|
POST
|
once again good call. my file was open and locked by arcmap when i used the incorrect open call new error: Runtime error Traceback (most recent call last): File "<string>", line 20, in <module> TypeError: sequence item 0: expected string, int found
... View more
02-07-2013
10:50 AM
|
0
|
0
|
1497
|
|
POST
|
thanks for the tip on the open statement. still getting the same runtime error: Runtime error Traceback (most recent call last): File "<string>", line 17, in <module> RuntimeError: cannot open 'c:\users\craig.mcdade\table.dbf'
... View more
02-07-2013
10:23 AM
|
0
|
0
|
1497
|
|
POST
|
well. I'm close now. The current code is: import arcpy, os
table = r"c:\users\craig.mcdade\GridforPython.dbf" # source_table
new_table = r"c:\users\craig.mcdade\table.dbf" # new table
tempTable = r'\\in_memory\temp_table'
outPath = r'\\in_memory\outPath'
keyField = 'NAME'
valField = 'Pg_Number'
tableDict = {}
arcpy.MakeTableView_management(table, tempTable)
with arcpy.da.SearchCursor(tempTable, [keyField, valField]) as cursor:
for row in cursor:
tableDict.setdefault(row[0], []).append(row[1])
open("new_table","w")
insertCursor = arcpy.da.InsertCursor(os.path.join(outPath, new_table), [keyField, valField])
for key, val in tableDict.iteritems():
insertCursor.insertRow((key, ', '.join(val)))
I was getting a Runtime Error: cannot open 'c:\...' so I added the open("new_table","w") line now I get a Runtime Error of Permission denied: 'new_table' I have allowed full permissions on the dbf file so I'm not sure why it isn't allowing it to open.
... View more
02-07-2013
09:21 AM
|
0
|
0
|
1497
|
|
POST
|
again you've been quite helpful and patient with my lack of understanding. I'm getting a similar error as with the above SearchCursor error: Runtime error Traceback (most recent call last): File "<string>", line 15, in <module> File "c:\program files (x86)\arcgis\desktop10.1\arcpy\arcpy\__init__.py", line 1180, in InsertCursor return gp.insertCursor(dataset, spatial_reference) File "c:\program files (x86)\arcgis\desktop10.1\arcpy\arcpy\geoprocessing\_base.py", line 369, in insertCursor self._gp.InsertCursor(*gp_fixargs(args, True))) RuntimeError: ERROR 999999: Error executing function. It is almost identical to the previous error, so using your example I made an attempt to fix this one with:
arcpy.insertCursor(new_table)
... with arcpy.da.InsertCursor(key, val in tableDict.iteritems()) as cursor:
... for row in cursor:
... row = insertCursor.newRow()
... row.setValue(keyField, key)
... row.setValue(valField, ', '.join(val))
... insertCursor.insertRow(row)
Am I at least close?
... View more
02-07-2013
06:37 AM
|
0
|
0
|
1497
|
|
POST
|
well it is working and creating the table view. but for whatever reason it isn't reading my new_table portion correctly I have inputed:
new_table = "c:\users\craig.mcdade\table.dbf" # new table
but getting this error: IOError: "c:\users\craig.mcdade able.dbf" does not exist as you can see, it is not recognizing the \t in the file structure?
... View more
02-07-2013
05:52 AM
|
0
|
0
|
1497
|
|
POST
|
that gets me: Runtime error Traceback (most recent call last): File "<string>", line 9, in <module> NameError: name 'tempTable' is not defined I appreciate your time and help. I'm also getting an error that my dbf file doesn't exist, so I converted it to an xlsx and don't get that error. Not sure if that matters, and for the new table I just created an empty excel spreadsheet. That could be wrong too. As you can tell. I'm new to this. thanks for your patience.
... View more
02-07-2013
04:54 AM
|
0
|
0
|
1846
|
|
POST
|
The table is a result of a spatial join that I performed, but there are no active joins from external tables.
... View more
02-07-2013
04:11 AM
|
0
|
0
|
1846
|
|
POST
|
Thanks! This looks promising. I inserted my values and am getting an ambiguous Runtime Error: Runtime error
Traceback (most recent call last):
File "<string>", line 10, in <module>
File "c:\program files (x86)\arcgis\desktop10.1\arcpy\arcpy\__init__.py", line 1133, in SearchCursor
return gp.searchCursor(dataset, where_clause, spatial_reference, fields, sort_fields)
File "c:\program files (x86)\arcgis\desktop10.1\arcpy\arcpy\geoprocessing\_base.py", line 359, in searchCursor
self._gp.SearchCursor(*gp_fixargs(args, True)))
RuntimeError: ERROR 999999: Error executing function.
... View more
02-07-2013
03:41 AM
|
0
|
0
|
1846
|
|
POST
|
In my data the NAME field refers to Fire Station Boundaries and the Pg_Number refers to the page in the mapbook. I'm trying to convert or create a table so that all pages that are within each boundary are listed together, separated by a comma. So instead of the table as it was originally uploaded, you would get a result of:
Name: Orange Lake
Pg_Number: 5, 6, 7, 8, 9, 10, 11, 12, 13, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 47
There are 33 unique NAME attributes. I need to create a mapbook of each NAME The goal after getting this would be then to take the page list and push it to export to pdf those pages. I went through the process manually yesterday and it was awful. I wound up taking that table, opening it in excel, downloading KuTools, using their combine tool to create the page listings (manually selecting which cells), then individually taking those page ranges and taking it back into ArcMap MapLogic tools and exporting from there. 10 hours of click.click.click. ugh. So I figure there has to be an easier/more efficient way than that.
... View more
02-06-2013
11:36 AM
|
0
|
0
|
1846
|
|
POST
|
I have an attribute table with approx 1000 records. There are two Fields I care about: Name and Pg_Number (see attached pic) I would like to consolidate the fields so that I received an output or a new field that combines the Pg_Number field based on the Name Field Ex. In my head its something like:
if [Name] = "Orange Lake" then [Pg_Number] = 5, 6, 7, 8, 9, 10...
if [Name] = "Green Lake" then [Pg_Number] = 11, 12, 13, 14, 15..."
and so on...
I haven't had much experience with Python but I'm trying to build a model/script and I'm getting stuck on how to do this field calc/consolidation. Any help would be appreciated.[ATTACH=CONFIG]21511[/ATTACH]
... View more
02-06-2013
09:52 AM
|
0
|
27
|
7196
|
|
POST
|
I've made some decent progress on my problem. I have now added a second service that can be identified. I'm still running into some issues that I hope somebody might be able to help with. The popup is only returning one of the services at full scale (the zoning service), however, if I zoom in to where the parcel service is visible it will only return the parcel service. How can I get it so that it returns both results with one click? Ultimately I only want it to return results when the layer is visible in the TOC. My new code: dojo.require("esri.dijit.Popup"); //Infowindow
var identifyTask,identifyParams;
function mapReady(map){
dojo.connect(map,"onClick",executeIdentifyTask);
//create identify tasks and setup parameters
identifyTaskZoning = new esri.tasks.IdentifyTask("https://www.marioncountyfl.org/arcgis/rest/services/Dynamic/Zoning/MapServer");
identifyTaskParcels = new esri.tasks.IdentifyTask("https://www.marioncountyfl.org/arcgis/rest/services/Dynamic/Parcels/MapServer");
//Set Zoning Parameters
identifyParamsZoning = new esri.tasks.IdentifyParameters();
identifyParamsZoning.tolerance = 7;
identifyParamsZoning.returnGeometry = true;
identifyParamsZoning.layerIds = [0,1,2,3,4];
identifyParamsZoning.layerOption = esri.tasks.IdentifyParameters.LAYER_OPTION_VISIBLE;
identifyParamsZoning.width = map.width;
identifyParamsZoning.height = map.height;
//Set Parcel Parameters
identifyParamsParcels = new esri.tasks.IdentifyParameters();
identifyParamsParcels.tolerance = 15;
identifyParamsParcels.returnGeometry = true;
identifyParamsParcels.layerIds = [0,1,2,3,4];
identifyParamsParcels.layerOption = esri.tasks.IdentifyParameters.LAYER_OPTION_VISIBLE;
identifyParamsParcels.width = map.width;
identifyParamsParcels.height = map.height;
//resize the map when the browser resizes
dojo.connect(dijit.byId('map'), 'resize', map,map.resize);
};
function executeIdentifyTask(evt){
identifyParamsParcels.geometry = evt.mapPoint;
identifyParamsParcels.mapExtent = map.extent;
var deferred = identifyTaskParcels.execute(identifyParamsParcels);
deferred.addCallback(function(response){
if (response.length > 0) {
// console.log(response.length)
// response is an array of identify result objects
// Let's return an array of features.
return dojo.map(response, function(result){
var feature = result.feature;
feature.attributes.layerName = result.layerName;
if(result.layerName === 'TaxParcel'){
console.log(feature.attributes.NAME);
var template = new esri.dijit.PopupTemplate({
title:"Parcels",
description:"<b>Parcel ID:</b> {Parcel Identification Number} <br/> <b>Address:</b> {Site Address}"
});
feature.setInfoTemplate(template);
}
return feature;
});
}
else {
identifyParamsZoning.geometry = evt.mapPoint;
identifyParamsZoning.mapExtent = map.extent;
var deferred = identifyTaskZoning.execute(identifyParamsZoning);
deferred.addCallback(function(response){
// response is an array of identify result objects
// Let's return an array of features.
return dojo.map(response, function(result){
var feature = result.feature;
feature.attributes.layerName = result.layerName;
if(result.layerName === 'Zoning Classifications'){
console.log(feature.attributes.NAME);
var template = new esri.dijit.PopupTemplate({
title:"Zoning",
description:"<b>Zoning:</b> {Zoning Classification} <br/> <b>Description:</b> {Zoning Description}"
});
feature.setInfoTemplate(template);
}
else if (result.layerName === 'Assisted Living Facilities'){
var template = new esri.dijit.PopupTemplate({
title:"Assisted Living Facilities",
description:"<b>Parcel ID:</b> {Parcel} <br/> <b>Applicant:</b> {BusinessApplicantName} <br/> <b>No. of Residents</b> {NbrResidents}"
});
feature.setInfoTemplate(template);
}
else if (result.layerName === 'Family Divisions'){
var template = new esri.dijit.PopupTemplate({
title:"Family Divisions",
description:"<b>Parcel ID:</b> {Parcel} <br/> <b>Project Number:</b> {project_nbr} </br> <b>Status:</b> {Status}"
});
feature.setInfoTemplate(template);
}
else if (result.layerName === 'Policy 120'){
var template = new esri.dijit.PopupTemplate({
title:"Policy 120",
description:"<b>Parcel ID:</b> {Parcel} <br/> <b>Business Name:</b> {BusinessName} </br> <b>Date of Letter:</b> {DateOfLetter}"
});
feature.setInfoTemplate(template);
}
else if (result.layerName === 'Zoning Changes'){
var template = new esri.dijit.PopupTemplate({
title:"Zoning Changes",
description:"<b>Parcel ID:</b> {Parcel} <br/> <b>Request Number:</b> {REQUEST_NBR} </br> <b>Property Owner:</b> {PROPERTY_OWNER}"
});
feature.setInfoTemplate(template);
}
return feature;
});
});
};
map.infoWindow.setFeatures([deferred]);
map.infoWindow.show(evt.mapPoint);
});
map.infoWindow.setFeatures([deferred]);
map.infoWindow.show(evt.mapPoint);
};
... View more
01-28-2013
04:50 AM
|
0
|
0
|
548
|
|
POST
|
can you add a more complete code sample of what you have? Is your //Create data store and bind to grid.
store = new dojo.data.ItemFileReadStore({ data:data });
var grid = dijit.byId('grid');
grid.setStore(store); within the showResults(results) function?
... View more
01-25-2013
05:56 AM
|
0
|
0
|
945
|
|
POST
|
I have three services that I need to be identified, only when the layers are visible. Currently my code references 1 service. I have followed the steps outlined in this thread (I think), however, the app still identifies if a layer is turned off in the TOC. Link to my App. I have also attempted to implement the code sample found here, without any luck. I guess my question/issue is two pronged to try and get maximum understanding of the processes: 1. How can I make my code ID layers only when visible? 2. How can I add the additional services to my code and ID all three services only when visible? My current code is: dojo.require("esri.dijit.Popup"); //Infowindow
var identifyTask,identifyParams;
function mapReady(map){
dojo.connect(map,"onClick",executeIdentifyTask);
//create identify tasks and setup parameters
identifyTask = new esri.tasks.IdentifyTask("https://www.marioncountyfl.org/arcgis/rest/services/Dynamic/Zoning/MapServer");
identifyParams = new esri.tasks.IdentifyParameters();
identifyParams.tolerance = 3;
identifyParams.returnGeometry = true;
//Choose which layers in the array you would like to be ID'd in the popup
identifyParams.layerIds = [0,1,2,3,4];
identifyParams.layerOption = esri.tasks.IdentifyParameters.LAYER_OPTION_VISIBLE;
identifyParams.width = map.width;
identifyParams.height = map.height;
}
function executeIdentifyTask(evt) {
identifyParams.geometry = evt.mapPoint;
identifyParams.mapExtent = map.extent;
identifyParams.layerIds = visible
var deferred = identifyTask.execute(identifyParams);
deferred.addCallback(function(response) {
// response is an array of identify result objects
// Let's return an array of features.
return dojo.map(response, function(result) {
var feature = result.feature;
feature.attributes.layerName = result.layerName;
if(result.layerName === 'Zoning Classifications'){
console.log(feature.attributes.NAME);
var template = new esri.dijit.PopupTemplate({
title:"Zoning",
description:"<b>Zoning:</b> {Zoning Classification} <br/> <b>Description:</b> {Zoning Description}"
});
feature.setInfoTemplate(template);
}
else if (result.layerName === 'Assisted Living Facilities'){
var template = new esri.dijit.PopupTemplate({
title:"Assisted Living Facilities",
description:"<b>Parcel ID:</b> {Parcel} <br/> <b>Applicant:</b> {BusinessApplicantName} <br/> <b>No. of Residents</b> {NbrResidents}"
});
feature.setInfoTemplate(template);
}
else if (result.layerName === 'Family Divisions'){
var template = new esri.dijit.PopupTemplate({
title:"Family Divisions",
description:"<b>Parcel ID:</b> {Parcel} <br/> <b>Project Number:</b> {project_nbr} </br> <b>Status:</b> {Status}"
});
feature.setInfoTemplate(template);
}
else if (result.layerName === 'Policy 120'){
var template = new esri.dijit.PopupTemplate({
title:"Policy 120",
description:"<b>Parcel ID:</b> {Parcel} <br/> <b>Business Name:</b> {BusinessName} </br> <b>Date of Letter:</b> {DateOfLetter}"
});
feature.setInfoTemplate(template);
}
else if (result.layerName === 'Zoning Changes'){
var template = new esri.dijit.PopupTemplate({
title:"Zoning Changes",
description:"<b>Parcel ID:</b> {Parcel} <br/> <b>Request Number:</b> {REQUEST_NBR} </br> <b>Property Owner:</b> {PROPERTY_OWNER}"
});
feature.setInfoTemplate(template);
}
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.
map.infoWindow.setFeatures([ deferred ]);
map.infoWindow.show(evt.mapPoint);
}
... View more
01-25-2013
05:17 AM
|
0
|
3
|
794
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 01-16-2014 09:52 AM | |
| 6 | 06-12-2013 08:01 AM |
| Online Status |
Offline
|
| Date Last Visited |
11-11-2020
02:23 AM
|