|
POST
|
Yes, the sample code was very helpful. Spent too much time looking through the Syntax and Properties section, when the sample had a clear example of the test. And yes lower case w on workspace was also needed. I couldn't figure out why my raster list seemed to be empty when it hit line 20. This code worked on a sample data folder. Now I'll run it on the rest. I'm not sure if this testing if the coordinate system is undefined decreased run time or if I could even notice a difference with 370 files. Maybe 3000 files. import sys, os, arcpy
from arcpy import env
# Load required toolboxes...
#gp.AddToolbox("C:/Program Files/ArcGIS/ArcToolbox/Toolboxes/Data Management Tools.tbx")
#workspace
env.workspace = "G:\\usgs_quads\\test"
#coordsys = "C:\\Program Files\\ArcGISCoordinate Systems\\Projected Coordinate Systems\\National Grids\\British National Grid.prj"
#List all features in gp.workspace
rasters = arcpy.ListRasters("*", "TIF")
#raster = rasters.Next()
# get the coordinate system by describing a feature class
dsc = arcpy.Describe("YESMOWIT CANYON.tif")
coord_sys = dsc.spatialReference
for raster in rasters:
# Create the spatial reference object
spatial_ref = arcpy.Describe(raster).spatialReference
# If the spatial reference is unknown
if spatial_ref.name == "Unknown":
arcpy.DefineProjection_management(raster, coord_sys)
print raster + " is defined."
... View more
01-14-2016
03:13 PM
|
1
|
15
|
3128
|
|
POST
|
I figure the code would be something like this, revised slightly from something I had laying around for fixing shapefiles, trying to remove the old style gp stuff. I'm still trying to figure out how I might test for projection undefined. but it might run just as fast without the test. import arcgisscripting, sys, os, arcpy
from arcpy import env
# Load required toolboxes...
#gp.AddToolbox("C:/Program Files/ArcGIS/ArcToolbox/Toolboxes/Data Management Tools.tbx")
#workspace
env.Workspace = "G:\\usgs_quads\\test"
#coordsys = "C:\\Program Files\\ArcGISCoordinate Systems\\Projected Coordinate Systems\\National Grids\\British National Grid.prj"
#List all features in gp.workspace
rasters = arcpy.ListRasters("*", "TIF")
#raster = rasters.Next()
# get the coordinate system by describing a feature class
dsc = arcpy.Describe("YESMOWIT CANYON.tif")
coord_sys = dsc.spatialReference
for raster in rasters:
arcpy.defineprojection(raster, coord_sys)
print fc + " is defined."
... View more
01-14-2016
02:42 PM
|
1
|
17
|
3128
|
|
POST
|
I have a directory with 370 tifs. I just found out that a few, an unknown number, have the projection undefined, but they draw aligned with the know projection tifs, so no mystery there. I thought I could loop through a list of tifs in the folder and set the definition on the files missing, similar to https://community.esri.com/thread/13078 but wondered if I should add an "if" to check if the image is one of the ones with projection undefined. But what would be that test? Do you think the test would speed up execution or not?
... View more
01-14-2016
02:02 PM
|
0
|
19
|
7677
|
|
POST
|
I have GIS users in a field office who tell me that they have to avoid using ESRI basemaps because their internet connection is so slow. I already offer them image services of some air photo sets with ArcServer 10.3.1 which sort of substitutes for ESRI's imagery base maps. I thought, hey, I have a set of USGS quads for our state (Washington) and have ArcServer 10.3.1 running in the office, maybe I can create my own background map of topos for these users. I launched an image service of a mosaic of a small area of quads. It looks good at scales 1:24000 and larger, but starts to look crappy zoomed out much more than that. What's a source for 100k and 250k USGS topos for Washington State? Should my approach be to publish as a map service to handle the scale dependencies, so the service will switch to the appropriate map for the users map frame?
... View more
01-14-2016
11:06 AM
|
0
|
1
|
1799
|
|
POST
|
I've been at this so long that sometimes, no, often, I forget stuff I used to know. And sometimes I find something in Help that makes me think, "Hey, there's a new tool for this!" but it's an unrelated search hit, and sends me off the wrong direction. Thanks for pulling me back on track.
... View more
12-21-2015
09:12 AM
|
0
|
0
|
2142
|
|
POST
|
Thanks, I think Stream to Feature might have helped me, because Raster to Polyline gave me a stream line going the wrong direction which I didn't notice until after I added the elevations.
... View more
12-17-2015
03:51 PM
|
0
|
1
|
2142
|
|
POST
|
No, it's not that. I guess I don't need the Route Editing toolbar at all. I just need to run the Create Routes tool on my polyline feature. Then the Shape* attribute changes from Polyline to Polyline M and I can then add my event table.
... View more
12-17-2015
03:42 PM
|
0
|
0
|
2142
|
|
POST
|
I'm trying to use a elevation raster to create a new routed stream line, but I can't believe how stuck I am. I went through Fill, Flow Direction, Flow Accumulation, and Con to get a raster the stream lines as the highest accumulations in my AOI. Then I used Raster to Polyline and got a polyline shapefile of the streams from which I selected the one stream line I want to analyze and made a new shapefile. But when I start an edit session, select the stream line, and try the Make Route tool, I get "No accptable target available. Make Route creates M aware polylines." Is my problem that I have a polyline not a line shapefile? I can't find a way to convert polylines to lines. I'm just trying to create some pairs of stream measure and elevation to give to a colleague in a spreadsheet. I did it once with some routed lines I already had, but wanted to run it again on a stream line directly from the elevation raster.
... View more
12-17-2015
03:07 PM
|
0
|
6
|
6764
|
|
POST
|
It appears that there were two different problems. With Ahmed from ESRI Customer Care, I figured out that something was wrong with the first copy of the table. I made a new copy of the EROM table into SDE and that helped. Unknown what was wrong with that first copy. But we also found out that when making the Join, I had to check the box to use the "Keep only matching records" option. If either the feature class or the table was from the file geodatabase, "Keep only matching records" was not necessary. The NHDPlus Feature Class is a line feature class with 272340 records. The joined table EROM has 238811 records. But there are 39529 records in the Feature Class that have no match in the table. I didn't know there were that many mismatched records. I had to run the selection again to be sure. These unmatched records with a null value in the graduated symbol item seemed to upset the drawing in the SDE feature class - SDE table drawing, but the other pairings were not as sensitive. I did some further testing with the complicated graduated symbology and differences in draw times with SDE and File Geodatabases. SDE Feature Class - SDE table - Keep Only Matching records- draw time 9.7 seconds SDE Feature Class - FGDB table - Keep All - 58.0 seconds SDE Feature Class - FGDB table - Keep only - 51.7 seconds FGDB Feature Class - FGDB table - Keep Only - 44.7 seconds FGDB Feature Class - FGDB table - Keep all - 48.3 seconds These are the kind of performance gains I was hoping for with SDE! I'm glad it works.
... View more
12-08-2015
10:28 AM
|
1
|
0
|
1046
|
|
POST
|
I'm still trying to get used to Enterprise geodatabase 10.3.1 based on SQL 2012 R2. Migrated all my data over from SDE 9.3.1. Then I thought I'd move in some data from NHDPlus so I could offer my users a few layers of streams with line widths symbolized by average annual flow for different scales using a relate to the NHDPlus EROM_MA0001 table. I moved a file geodatabase containing the stream lines and table with indexes on the join items in each table over to the new enterprise geodatabase server. Imported the feature classes and table into an existing SDE geodatabase. The indexes seemed to be preserved in the import. But the strange thing is that when I set up the relate between the SDE line feature class and the SDE table, then try to symbolize the line width by flow from the related table, the feature class doesn't draw. I get a warning that sampling has reached its limit when I set up the symbology, but I continue to manually classify the symbol ranges to spread them from minimum to maximum flow. I tried some other tables and combinations of relates. It appears that if the feature class and the table are both in the enterprise geodatabase, nothing draws. If either or both the feature class and the table are the file geodatabase, it draws as expected with graduated symbols. Tried a feature class that is a geographically selected subset of the whole line feature class but got the same disappointing results. Is the enterprise geodatabase somehow getting tangled up when both the feature class and the table are in the same geodatabase? I thought I would be improved draw performance with the enterprise geodatabase.
... View more
11-30-2015
10:38 AM
|
0
|
1
|
3653
|
|
POST
|
We were getting this error trying to connect 10.3.1. and 10.2.2 Desktop to Server 10.3.1. Once we installed the new SQLNATIVEClient2012 driver, we are back in business. We are telling our users "You must install this Microsoft installation file with an account with administrative privileges’ on your machine. Restart your machine after installation." I'll try to find the link again.
... View more
11-23-2015
09:11 AM
|
1
|
1
|
614
|
|
POST
|
Plain old file geodatabases, just residing in a Windows folder? I thought I was going through all these extra steps to have the data reside in SQL server for a performance boast. And what about image services and map services: can I publish those from data residing in file geodatabases?
... View more
11-20-2015
04:35 PM
|
0
|
1
|
1457
|
|
POST
|
Jeez, my power user says that he managed to find an updated SQL communications driver from MS, and now his connection from Desktop 10.3.1 to 10.3.1 Enterprise geodatabase works. Is that crazy? Now what about connections from Desktop 10.2.2?
... View more
11-20-2015
04:18 PM
|
0
|
2
|
614
|
|
POST
|
I have a user with Desktop 10.3.1 that tried to connect to my new 10.3.1 geodatabases, but got "Failed to connect to the specified server. Do you want to continue? Connection was attempted with an older version of SQL Server client communications software that was not compatible withe the SQL Server database server." Does this user with a Windows 7 PC really need to go find an updated driver from MS to communicate?
... View more
11-20-2015
03:48 PM
|
0
|
3
|
614
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 11-28-2018 04:57 PM | |
| 3 | 09-20-2017 02:37 PM | |
| 1 | 09-20-2017 02:21 PM | |
| 1 | 03-09-2018 03:25 PM | |
| 1 | 03-12-2015 02:06 PM |
| Online Status |
Offline
|
| Date Last Visited |
11-11-2020
02:23 AM
|