|
POST
|
My program is to find missing records when comparing to layers inside an mxd and then highlight the ones that are missing. For example, if one layer has 105H1 then the other layer should have it if not then it highlights that record to alert the user it is missing in the other layer. Right, now it is highlighting ones that are missing but also highlighting random ones that are in both layers??? I think my problem is the loop at the bottom of my program but a) I'm not sure and b) I don't know how to fix it.
import arcpy, traceback
mxd = arcpy.mapping.MapDocument("CURRENT")
lstLayers = arcpy.mapping.ListLayers(mxd)
flayer = arcpy.mapping.ListLayers(mxd, "AADT")[0]
alayer = arcpy.mapping.ListLayers(mxd, "AADTAnnoLabel")[0]
FRows = arcpy.SearchCursor(flayer)
ARows = arcpy.SearchCursor(alayer)
ffields = arcpy.ListFields(flayer, "FLAG", "String")
afields = arcpy.ListFields(alayer, "TFLAG", "String")
FList = []
AList = []
for row in FRows:
Fvalue = row.getValue("FLAG")
FList.append(str(Fvalue))
for row in ARows:
Avalue = row.getValue("TFLAG")
AList.append(str(Avalue))
matched = set(FList) & set(AList)
for x in matched:
exp = '"FLAG" = ' + "'" + x + "'"
arcpy.SelectLayerByAttribute_management("AADT", "ADD_TO_SELECTION", exp)
arcpy.SelectLayerByAttribute_management("AADT", "SWITCH_SELECTION","#")
Well, not sure, but see a couple things that might be an issue. I can't get switch_selection to work right without the "#" at the end. Also, your select by attribute you are saying to select from layer AADT. How does it know what layer that is, didn't you assign it to the variable "flayer" and should use that instead. And, even though ArcMap will let you select by attributes and export to python, selectbyattributes will not work on a feature class itself (ArcMap converts to layer on fly). Not sure how you are selecting records unless you are running this from within ArcMap, as it won't allow me to run that on a feature class in stand alone python. To overcome this, I run a makefeaturelayer on the dataset before the selectbyattributes and switch_selection code. Then it will allow me to select by attributes, and switch. Unfortunatly, not anywhere I can test at the moment, but thought I'd throw in a couple ideas in case it helps, R_
... View more
05-23-2013
06:02 PM
|
0
|
0
|
1724
|
|
POST
|
Do you actually have a "raster" data set named S:\\MODIS\\DATA_v05\\modis016_0250_ndvi\\us\\or0101ndvius ? If so, what format is it, and you might try to remove the "'" from both ends of your grids## = assignments. If I type them in as you have them, I get " ' S:\\MODIS\\DATA_v05\\modis016_0250_ndvi\\us\\or0101ndvius ' " and it might be the extra quotes causing the issue. I don't have the data, so can't really test. If you don't have a raster with that name, that is what it is looking for so you might check to make sure the resultant path actually matches an existing raster. Running under the 64 bit IDE can give this error as well. Normally it is when you are trying to access something through an ArcCatalog connection though (since that only supports 32 bit, the 64 bit one can't find the ArcCatalog/connectionto/ files). R_
... View more
05-23-2013
05:08 PM
|
0
|
0
|
2499
|
|
POST
|
strings are iterable, so the first index will be the first letter. then I get the total number of characters, divide by two, and extract that one. >>> string = "FIGURINE" >>> string[0] 'F' >>> string[len(string)/2] 'R' >>> string[0] + string[len(string)/2] 'FR' >>> R_
... View more
05-23-2013
03:56 PM
|
0
|
0
|
5123
|
|
POST
|
The method Robert mentioned doesn't work for me as I want my blank one listed first in the list. If done with a blank URL, I don't get the tile info, and the other tiled layers error out. What I have done is create an empty ArcMap (actually, one layer with color = null) document in my wkid, then published to a service, and created the same cache tiles as the rest of my map. Works like a charm. R_
... View more
05-23-2013
10:37 AM
|
0
|
0
|
1006
|
|
POST
|
The code you have is expecting a path to the image in your "Image" field, not an image itself. Where you say one of the fields is a type of raster.. Are you saying that you have the raster stored in a BLOB field in the table itself? If so, the only BLOBs supported by the REST are the ESRI attachments. If this is the case, you could use your data as the lookup table and use the attachemnts tool to extract the images out, then add them in as attachments. Attachments are fullly supported within the flex popups. R_
... View more
05-22-2013
03:25 PM
|
0
|
0
|
785
|
|
POST
|
This one works in 3.1 and 3.3. have not tried it in 3.2. I have modified it so the loadbottom tag is no longer valid. Instead, there is a checkbox on the widget, you check the box if you want it to load to bottom of TOC. Of course there are some issues. Often, after you load it, it will not be visible until you un-check it and re-check the box. If you set as visible in the config, you will have to check it again, so works "best" with visible="false". R_
... View more
05-22-2013
12:20 PM
|
0
|
0
|
929
|
|
POST
|
This is working for me. Not sure what all I've modified other than adding a help icon to the widget. R_
... View more
05-22-2013
11:19 AM
|
0
|
0
|
2155
|
|
POST
|
Jeff, I have wanted that, but don't see any time available in the future to really look into it. I know that Mads autocomplete search does this http://forums.arcgis.com/threads/20978-Autocomplete-search-box?highlight=autocomplete and Robert's eSearch uses a paging query (believe this gets past the limited number of returns the service sends) to populate the uniquevaluesfromfield list. Might be able to utilize one of these for ideas/snippets. Also, here Robert has posted snippet that loads the services into an array, then the layers of that service into an array. Might be able to take it a couple steps further and get the fields/attributes into an array as well. Just a thought. http://forums.arcgis.com/threads/81057-Aide?p=289399#post289399 Also, I see the selectionwidget http://www.arcgis.com/home/item.html?id=20ed6af9ab204548bbf092d51b51fef8 uses a pagingquerytask.as to accomplish this as well. R_
... View more
05-22-2013
11:12 AM
|
0
|
0
|
1836
|
|
POST
|
The layers in the TOC are in the reverse order that they are listed in the main config.xml. So, the first layer listed under <operationallayers> will be at the bottom of the TOC, the last layer in the <operationallayers> section will be at the top of the TOC. R_
... View more
05-22-2013
08:59 AM
|
0
|
0
|
3721
|
|
POST
|
Are you using the ESRI print task or your own? If using the ESRI print task server, can you send me the actual link to your service? If i can't see it, then neither can ESRI's server and it wont work. If using your own server print task, can you see the below link in your browser from outside your lan (putting in your actual server name of course). Hi again, http://www/arcgis/rest/services/LAYER/MapServer R_
... View more
05-22-2013
08:51 AM
|
0
|
0
|
1813
|
|
POST
|
Sofia, I am currently out of the office, and won't be back in until next wednesday. If you still need it the, I can dredge it up. R_
... View more
05-14-2013
01:46 PM
|
0
|
0
|
2155
|
|
POST
|
So am I. Updating the layout templates If you want to update the layouts in your layout templates folder, the appropriate workflow is determined by whether you registered the layout templates folder with the server before publishing (see the previous section "Registering your layout templates with ArcGIS Server"). Updating the layout templates folder if you registered it with ArcGIS Server If you registered your layout templates folder with the server, this means the server can see your layouts. Simply make updates to the MXDs in the folder and your new layouts will be immediately available. Updating the layout templates folder if you did not register it with ArcGIS Server If you did not register your layout templates folder with the server, the layouts were copied to the server at the time of publishing. You need to perform a service overwrite to update the templates on the server. Follow these steps to do the overwrite: Steps: In ArcMap, open the Export Web Map tool and run it using your desired default values as described in the previous section. Right-click the geoprocessing result and choose Share As > Geoprocessing Service. Choose the option Overwrite an existing service and click Next. Click the name of the service you want to overwrite and click Continue. On the Service Editor, verify that all the service properties are set to your liking (they should default to the properties you chose when you originally published the service). Then click Publish. The options you choose overwrite all options set during the first publishing. The layout templates folder (including your updates) are copied to the server and replace the layout templates folder that was put there when you published the service originally. from here: http://resources.arcgis.com/en/help/main/10.1/index.html#/Tutorial_Publishing_additional_services_for_printing/0154000005n1000000/ R_
... View more
05-14-2013
08:14 AM
|
1
|
0
|
1309
|
|
POST
|
According to the documenation, if the templates folder is registered with your server, you can make the change and it will automatically update it. However, I have had zero success with this, even re-starting server/computer. If I make the change, then re-create my export web map service, THEN it will see the changes I made to the templates. R_
... View more
05-14-2013
07:30 AM
|
0
|
0
|
1309
|
|
POST
|
Rhett: Does your script convert BLOB field data for individual records or does it convert BLOB field data for an entire feature class (or however the entire data set is stored)? This seems like a duplication of file storage as the data is basically being stored in 2 different formats. Is there no tool in FlexViewer that can currently read directly from a BLOB field and display an item such as a jpeg image that is stored in the BLOB format. That seems like a more efficient system. Michael, My script works on a table (does not have to be a feature class) and "extracts" whatever data is in the BLOB field for that record and saves it to a file. Since I already know that all "objects" stored in my blob fields are jpegs, I name it with a .jpg on the end (could easily be a text file, or whatever in a BLOB, so you need to know what you are extracting). The parts of my script I cut out actually look at what images have "changed", and re-extracts only them. Can easilly add whatever logic you need to only extract what you want. You are correct, it IS a duplication of data, but, is the best solution I have come up with and really doesn't put much of a dent in my 12 TB. As far as server supporting BLOBs, the only BLOBs I know that are supported are attachments as they are stored as BLOBs in a FGDB. Hopefully in the future, ESRI can extend that to non-ESRI BLOB fields as well. If you have a simple 1:1 relationship, the attachments is probably the way to go, not to mention they automatically integrate with Flex popups. Still a duplication of files, but they are tied to your data. You could use something similar to my script to extract the images, then use the attachments script to load them directly into the FGDB as attachments without actually saving them locally. However, the way attachments are currently, if you have a 1:many relationship with multiple features in a class, ALL attachments will be "linked" to the first feature in that class, and none of the others will have any attachments at all. I have many photos, and potentially many features per class, so this is the route I chose. There are several posts on the ideas page suggesting to improve the attachments tool to support a 1:many as well as to allow linking to a folder somewhere for attachemnts (this is a common one, as many people have their photos/etc. already saved somewhere, and don't want to have to copy them into the FGDB) You may want to promote some of these. I voted your latest one up as well. R_
... View more
05-14-2013
07:06 AM
|
0
|
0
|
2645
|
|
POST
|
You bet. Here is where I got the initial information. Also shows how to write to BLOB field as well. http://anothergisblog.blogspot.in/2012/06/working-with-blob-data-at-101-arcpyda.html R_
... View more
05-13-2013
03:48 PM
|
0
|
0
|
2645
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 05-14-2026 04:00 PM | |
| 1 | 09-14-2022 07:53 AM | |
| 1 | 09-14-2022 08:23 AM | |
| 1 | 05-21-2026 08:53 AM | |
| 1 | 05-14-2026 04:28 PM |
| Online Status |
Online
|
| Date Last Visited |
Wednesday
|