|
POST
|
I have a mosaic dataset that contains 25 rasters. They all have the same symbology, but there is no option to symbolize by unique values in a mosaiked dataset. Unique values would be a problem for multiple band images, but not for a single band. Am I missing something? The only options I have in the symbology tab are Vector Field, Classified, Stretched, and Discrete Color. This bug report says it was fixed in 10.1 NIM059496: Mosaic Datasets does not have an option for unique v.. It definitely wasn't though. I'm working with a 1-band, 8-bit unsigned integer, "continuous" mosaiked dataset on 10.5. Is the fact that it's labeled "continuous" the problem?
... View more
12-13-2017
08:48 AM
|
0
|
3
|
2467
|
|
POST
|
Nope, if I zoom in no imagery loads. The source images are no longer around, otherwise I would do just that! Thanks anyways though.
... View more
12-12-2017
12:18 PM
|
0
|
0
|
1383
|
|
POST
|
I took over a database someone else had migrated to our system a couple years ago. The (SDE) database is not often used and is really just here for reference purposes. I went to look at some raster data today and it is in a raster catalog, which I have never used before. When I add it to ArcMap, it appears as one giant polygon, like so: When I open the attribute table, I can see 26 rasters are contained in the catalog, but if I zoom in, no imagery appears, it remains the same block as above, no real "wireframe" either. I am wondering how rasters are stored in raster catalogs, is there usually a GDB or something that is storing the actual source rasters and the catalog is referencing that GDB? I'm thinking because the SDE database doesn't contain these source rasters anywhere, maybe that's why I can't view them via the catalog? Again, I have zero idea how raster catalogs work and the documentation doesn't explain their inner workings very well... Portion of attribute table for reference: When I first added the catalog to the map, there was a dialogue about it not being spatially referenced (coordinate system: <undefined>). I put a projection on it, but nothing changed aside from the warning dialogue going away. Not sure if I did something wrong by doing that or not. EDIT: After some more tooling around, I'm wondering if maybe I can't view the rasters because I don't have the associated files that would create a legend. For instance, if the rasters were TIF files, you'd have associated .tif.vat.dbf files to create a legend. I can see the raster is there, just can't view it in the dataframe: When one is selected: Converting it to a mosaic doesn't seem to do much besides generate the wireframes:
... View more
12-12-2017
10:27 AM
|
0
|
2
|
1795
|
|
POST
|
I'm a total newbie to web development, so this may be kind of a stupid question, however... I have a .NET application that calls out to a python script after a user uploads some data. This python script connects to an SDE database and manipulates the data they uploaded to insert into the database. What I'm wondering is when the application is accessed by users remotely, are they going to be able to make the database connection just because it's scripted in (e.g. arcpy.env.workspace = r'Database Connections\myDatabase.sde')? What kind of permissions would they need? When I think about it, I can access the database and run the script because my windows authentication verifies my permissions to access that database. I imagine when this application goes into production, there will need to be some alternate way to verify the user is allowed to connect to the database because even though the script resides on my computer and I'm authorized, I'm not the one accessing it. Does that make sense?
... View more
11-13-2017
12:58 PM
|
0
|
2
|
1267
|
|
POST
|
The solution is to move everything out of the "try" block except for the execute statement. That way the gp object is moved into the local scope where it can be accessed by the "catch" block. IGeoProcessor2 gp = new GeoProcessorClass();
gp.AddToolbox("myPathToToolboxPopulatePatches");
IVariantArray parameters = new VarArrayClass();
parameters.Add(shapefile);
try
{
gp.Execute("PopulatePatches",parameters, null);
}
catch
{
object erSeverity = 2;
string erMessages = gp.GetMessages(ref erSeverity);
ViewBag.Messages = erMessages;
return View();
}
//more code if tool executes properly
return View();
... View more
11-09-2017
06:49 AM
|
0
|
0
|
1073
|
|
POST
|
I feel like I'm missing something really obvious, but I can't figure this out. I use ArcObjects to call out to a python script using gp.execute(). When that python script encounters an error, the c# script will stop executing, leaving me no way to get error messages from the python script because anything like gp.GetMessage(ref sev) has to come after the python script call, so it's never hit when the script is erroneous. How do you get your error messages?? Example: //junk here
gp.Execute("myscript", parameters, null); //error occurs here
gp.GetMessages(ref sev); //cannot actually get these messages because c# script stops executing
What about try/catch blocks? try{
//junk here
gp.Execute("my script, parameters, null) //error occurs
}
catch{
gp.GetMessages(ref sev) //can't reference gp object here because it is not in scope
}
... View more
11-08-2017
11:24 AM
|
0
|
1
|
1200
|
|
POST
|
Sadly, the sample data download link is broken so it's not particularly helpful, but you've given me something to start googling so thanks! Edit: Anybody looking for the sample data, I found it here: Geoprocessing events listener
... View more
10-30-2017
11:02 AM
|
0
|
0
|
1755
|
|
POST
|
I have a python script that does a lot of things with cursors and such. I have done a lot of arcpy.AddMessage throught the script to have it run in ArcMap with progress messages. Now, I am implementing this script in a .NET web application (MVC). I call it (using C#) like so: IGeoProcessor2 gp = new GeoProcessorClass();
gp.AddToolbox(@"C:\Users\mfxxx10\Desktop\GIS_Testing\HbtatTesting\HabitatMon.tbx");
IVariantArray parameters = new VarArrayClass();
parameters.Add(shapefile);
gp.Execute("PopulatePatches", parameters, null); Now, in my view, I have a button that you press to upload your file and run this script. When that button is pressed, I'd like to have something pop up indicating progress of the script running. What would be really awesome would be to get the progress messages (like those I have encoded with arcpy.AddMessage) to show up also, though this isn't entirely necessary. Is there any way to do this since I'm calling out to a python script rather than doing all the processing within the C# scripting?
... View more
10-25-2017
10:36 AM
|
0
|
4
|
2034
|
|
POST
|
I'm developing arcpy scripts in PyCharm, though I have also tested this in Wing IDE and it does the same thing. Is it normal that when you use arcpy.AddMessage() it prints to your console output? I know it does not do this in PythonWin (or it used to not do that ~2 years ago when I was using that IDE). I thought that AddMessage only allowed messages to show up when running the script tool in ArcMap, not in the console output and that's why you use AddMessage and print statements together in stand-alone scripts, so that way if you run it in a python IDE, you still get the messages. Note: I do not use arcpy.GetMessages() or GetMessage() anywhere within the script. I am running 10.5 (python 2.7) This arcpy.AddMessage("Hello")
print "Hello" will print this in the output window: Hello Hello
... View more
10-24-2017
09:11 AM
|
0
|
2
|
3041
|
|
POST
|
I don't have access to MyEsri as that is not how universities typically let you download the software as they don't want you to have access to the entire installation media. It's all very locked down. But anyway, I contacted our IT department and they've got me setup with access. Thanks.
... View more
10-23-2017
07:25 AM
|
0
|
0
|
1360
|
|
POST
|
I realize it comes with the installation media (in this case, a digital download, no CD). I have a feeling this has to do with my work place and how their licensing works (higher ed), but I cannot find an "sdk_dotnet" folder. Could someone tell me the location of it just so I can make sure I'm looking in the right place before contacting IT?
... View more
10-23-2017
05:50 AM
|
0
|
2
|
2730
|
|
POST
|
I have solved this issue, it appears there's a bug (shocker!). The float fields are the culprit, let me explain. In the shapefile I had set precision and scale of the field to 3 and 2, respectively. Unfortunately, these are reverted to 0 upon clicking "Ok" when adding the field (if I right-click the field and go to properties, I now see precision and scale are both 0 which isn't how I set them). Shapefiles are supposed to support precision and scale as per documentation here Working with fields in shapefiles by adding a field in ArcCatalog—Help | ArcGIS Desktop . This is the bug. My target SDE table class for inserting rows also had the matching float fields with precision and scale set to 3 and 2. This did not revert to 0, so now the scale in the shapefile float fields is much larger than the scale in the SDE feature class float fields. Because it reverted to 0, my float field in the shapefile is now interpreted by arcpy as having a much larger scale than it's supposed to, so when I try to use an insert cursor to take data from the shapefile and insert it into my SDE feature class fields, the float fields won't work, because the scale is too large, thus it won't copy ANYTHING over and it won't give you an error message either. For instance, my shapefile attribute table has a row where the float field value is 23.2. In arcpy, if I print that row, the value is interpreted as "23.2000000762939453" (how it derived such a number I do not know). Because my SDE feature class matching float field has a scale of 2, it will not accept such a long numeric value and will act like it's inserting rows but it isn't. The only way around this is to set my SDE feature class float fields to a precision and scale of 0 which isn't ideal, but it does allow the process to carry out successfully.
... View more
10-19-2017
05:55 AM
|
2
|
1
|
3353
|
|
POST
|
Yup, it's there. I have traced the problem to the "float" fields in my SDE table. When I have a specific precision and scale set, it will not insert any values for any of the rows, even though the data types match (both float) on either attribute table. The float values I am trying to copy over fit within the precision and scale I have set on the SDE table (3 and 2 respectively). If I just leave precision and scale as 0, it works fine and copies the data over. This problem can actually be traced back to the shapefile not enforcing precision and scale. I can make a float field in my shapefile, set precision and scale, hit ok and then go right click that field to view the properties and the precision and scale have been reverted to 0. Shapefiles are supposed to support precision and scale for float fields as seen here Working with fields in shapefiles by adding a field in ArcCatalog—Help | ArcGIS Desktop so this seems like a bug.
... View more
10-19-2017
04:57 AM
|
0
|
0
|
9762
|
|
POST
|
I have a script that uses a search cursor on a shapefile to retrieve data, add a few things, puts each row in a list, and then copies each item in that list as a new row to a SDE feature class using an insert cursor. The problem is that when I use the insert cursor, it doesn't insert any rows into the SDE feature class, even though I get an exit code of 0 and no error messages. Based on the output window, it appears to have inserted the rows but if I go look at the feature class, nothing is there. I have tested the script by using an insert cursor on a regular file geodatabase feature class and it works just fine, so there must be something special about the SDE environment that I'm missing. I have the appropriate data types and number of items to match to fields, so it is not a sequence size error or a data type issue. I have attempted to carry out the insert cursor action inside an editing session (edit.startEditing(False, False) and edit.stopEditing(True)) but no luck with that. The data is not versioned and never will be. Could that be what is causing the issue? Is there something about database permissions that I don't understand and need to write into the code? Script: #Set the workspace to access feature classes in the HbMonitoringTest database
arcpy.env.workspace = r'C:\Users\user\AppData\Roaming\ESRI\Desktop10.5\ArcCatalog\myDbName_HbMonitoringTest.sde'
#Getting feature classes from database
PatchesFC = "Patches"
#Get input shapefile from user
InputFC = r'C:\Users\user\Desktop\GIS_Testing\HbtatTesting\ExpTestFC.shp'
#Set search cursor fields to iterate through the input feature class
scFields = ['SHAPE@','StrMPID', 'StateID', 'Point', 'PatchNum', 'IsDevelope',
'CropTypeID', 'CropResidu', 'CnpyOver12', 'CnpyDecid',
'CnpyConif', 'ShrubCover','ShbHiStems', 'GrassCover',
'ForbCover', 'FrbAsProte', 'ForbSpecie', 'BareGround',
'HerbHeight', 'IsQuailHab', 'ObsvDate']
#Set insert cursor fields to add new rows to Patches feature class
icFields = ['SHAPE@', 'MonitoringPointID', 'PatchID', 'StateID', 'Point', 'PatchNum',
'IsDeveloped', 'CropTypeID', 'CropResidue', 'CnpyOver12', 'CnpyDecid',
'CnpyConif', 'ShrubCover', 'ShbHiStemsDens', 'GrassCover', 'ForbCover',
'FrbAsProtect', 'ForbSpecies', 'BareGround', 'HerbHeight', 'IsQuailHab',
'ObsvDate', 'ObserverID']
#Instantiate empty list to add edited rows too
rows2Insert = []
#Create search cursor to pull data from the attribute table of the user-input shapefile
with arcpy.da.SearchCursor(InputFC, scFields) as sCursor:
for row in sCursor:
rowList = list(row)
PatchID = '{' + str(uuid.uuid4()).upper() + '}'
ObserverID = None
rowList.insert(2, PatchID)
rowList.append(ObserverID)
rows2Insert.append(rowList)
#Create insert cursor to insert new rows into the Patches database
with arcpy.da.InsertCursor(PatchesFC, icFields) as iCursor:
for item in rows2Insert:
print item
iCursor.insertRow(item)
print "Row inserted." This is the output I get in the output window upon running the script:
... View more
10-18-2017
10:31 AM
|
0
|
2
|
4341
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 06-18-2020 10:31 AM | |
| 2 | 09-16-2025 02:17 PM | |
| 3 | 09-12-2025 09:26 AM | |
| 1 | 08-16-2023 05:11 PM | |
| 1 | 02-27-2024 06:48 AM |
| Online Status |
Offline
|
| Date Last Visited |
09-16-2025
02:16 PM
|