|
POST
|
No, it should end with: "Get Area Info...." In Windows Explorer, check to make sure you shapefile does not have an associated .prj file with it. If it does, delete the .prj file and then try executing the script again. Also, check the output geodatabase to see if the feature class was created.
... View more
12-30-2011
09:29 AM
|
0
|
0
|
761
|
|
POST
|
Not sure why the copy/paste did not work. You were receiving your initial error because you were missing a parentheses at the end of the following line: outFeatureClass = os.path.join(outWorkspace, infc.strip(".shp") Should be: outFeatureClass = os.path.join(outWorkspace, infc.strip(".shp"))
... View more
12-30-2011
09:16 AM
|
0
|
0
|
1562
|
|
POST
|
The arcpy module is case-sensitive. You will need to change it to sr.name. If you copy and paste the code I uploaded into Pythonwin, it should run successfully. I don't believe I changed any of the paths.
... View more
12-30-2011
08:33 AM
|
0
|
0
|
1562
|
|
POST
|
You will not need to use 'continue'. if sr.name == "Unknown":
# Determine the new output feature class path and name
outFeatureClass = os.path.join(outWorkspace, infc.strip(".shp"))
# Set output coordinate system
outCS = "Coordinate Systems\Geographic Coordinate Systems\World\WGS 1984.prj"
outCS2 = "Coordinate Systems\Projected Coordinate Systems\World\Cylindrical Equal Area (world).prj"
arcpy.DefineProjection_management(infc, outCS)
arcpy.Project_management(infc, outFeatureClass, outCS2)
arcpy.AddMessage("The shapefiiles have been reprojected")
print "Get Area Info...."
... View more
12-30-2011
08:23 AM
|
0
|
0
|
1562
|
|
POST
|
You will not have to use 'continue'. You should have your functions under the 'if' statement (since you want to project all shapefiles with an Unknown coordinate system), and 'pass' under your 'else' statement. Pass will skip the shapefiles that have a coordinate system defined: if sr.name == "Unknown": # Determine the new output feature class path and name outFeatureClass = os.path.join(outWorkspace, infc.strip(".shp")) # Set output coordinate system outCS = "Coordinate Systems\Geographic Coordinate Systems\World\WGS 1984.prj" outCS2 = "Coordinate Systems\Projected Coordinate Systems\World\Cylindrical Equal Area (world).prj" arcpy.DefineProjection_management(infc, outCS) arcpy.Project_management(infc, outFeatureClass, outCS2) arcpy.AddMessage("The shapefiiles have been reprojected") print "Get Area Info...." else: pass
... View more
12-30-2011
08:21 AM
|
0
|
0
|
1562
|
|
POST
|
One other change you should make. Change the following line: desc = arcpy.Describe("Animals.shp") to desc = arcpy.Describe(infc)
... View more
12-30-2011
08:11 AM
|
0
|
0
|
1562
|
|
POST
|
You will need to first define the projection of the shapefile that has an Unknown coordinate system, and then reproject the shapefile to your desired coordinate system. I highlighted in bold the areas I changed: # Import system modules
import arcpy
from arcpy import env
import os, glob
# Set environment settings
arcpy.env.workspace = ("G:/Animals")
# Set local variables
outWorkspace = ("G:/Animals/Reproject_Out.gdb")
# Use ListFeatureClasses to generate a list of shapefiles in the
# workspace shown above.
fcList = arcpy.ListFeatureClasses()
print fcList
# Set coordinate system only for those inputs which have a defined spatial reference
for infc in fcList:
# Determine if the input has a defined coordinate system
desc = arcpy.Describe("Animals.shp")
sr = desc.spatialReference
if sr.name == "Unknown":
# Determine the new output feature class path and name
outFeatureClass = os.path.join(outWorkspace, infc.strip(".shp"))
# Set output coordinate system
outCS = "Coordinate Systems\Geographic Coordinate Systems\World\WGS 1984.prj"
outCS2 = "Coordinate Systems\Projected Coordinate Systems\World\Cylindrical Equal Area (world).prj"
arcpy.DefineProjection_management(infc, outCS)
arcpy.Project_management(infc, outFeatureClass, outCS2)
arcpy.AddMessage("The shapefiiles have been reprojected")
... View more
12-30-2011
08:04 AM
|
0
|
0
|
2525
|
|
POST
|
When you are projecting the shapefile, I don't see where you assigned a coordinate system to the 'outCS' variable. arcpy.Project_management(infc, outFeatureClass, outCS)
... View more
12-30-2011
06:54 AM
|
0
|
0
|
2525
|
|
POST
|
Hi Stephanie, Attached is an example on how to do this using the field calculator. Make sure that 'Python' is checked at the top. In the example, the values exists in a field called 'FullAddr', and I'm calculating the value to the left of the hypen to a field called 'Address'. You can do the same for the text to the right of the hypen. You will just need to change [0] to [1].
... View more
12-30-2011
06:23 AM
|
0
|
0
|
5887
|
|
POST
|
Can you post the entire script? Be sure to enclose it with tags (the # symbol) to preserve indentation.
... View more
12-30-2011
05:46 AM
|
0
|
0
|
2525
|
|
POST
|
I don't believe you will be able to pass a variable for a Update/Search/Insert Cursor. When you specify 'row.fname', the cursor looks for a field called 'fname', even if 'fname' was defined as a variable before hand. The cursor cannot distinguish this. I would recommend using the Field Calculator. You can pass a variable with this function. Ex: outshp = "Test.shp"
fname = "id"
isyear = 1
arcpy.CalculateField_management(outshp, fname, isyear)
... View more
12-29-2011
08:00 AM
|
0
|
0
|
1326
|
|
POST
|
If you are using an Enterprise license with SQL Server 2008 Standard/Enterprise, you should not be able to make a connection to the database through 'Database Servers'. Are all your connections through 'Database Servers', or do you have others connections under 'Database Connections'? You can compare the connection properties of the two to see if they are connecting to the same SQL Server instance.
... View more
12-29-2011
07:46 AM
|
0
|
0
|
2712
|
|
POST
|
Hi Ryan, If you are connecting to your geodatabase using 'Database Servers' then you are creating a direct connection. You cannot have an application server connection (use an SDE service) created through 'Database Servers'. Do you have two ArcSDE licenses, one for Workgroup and another for Enterprise? A Workgroup license uses SQL Server Express for the database. With this type of license, you can create an administrative connection to your geodatabase through 'Database Servers'. With an Enterprise license the ArcSDE Post-Installation is included. You can use the ArcSDE Post-Installation to create a service to connect the geodatabase, rather than use a direct connection.
... View more
12-29-2011
06:44 AM
|
0
|
0
|
2712
|
|
POST
|
Hi Abhijeet, What user are you connected to your database as? If you are using the SDE user, try creating a new user who's default tablespace is different than SDE. Then see if you receive the same error message when attempting to load data into the geodatabase. We recommend that you don't load data as the SDE user.
... View more
12-29-2011
02:41 AM
|
0
|
0
|
2065
|
|
POST
|
By default, when replicating tables the 'Check Out' for the table is set to Schema Only rather than 'All Records'. You will need to go into the advanced options when creating the replica (screen1.png). Then you can set the 'Check Out' to 'All Records' (screen2.png).
... View more
12-29-2011
01:48 AM
|
0
|
0
|
1849
|
| Title | Kudos | Posted |
|---|---|---|
| 4 | 05-07-2020 05:14 PM | |
| 1 | 03-25-2026 04:16 AM | |
| 1 | 03-16-2026 01:00 PM | |
| 1 | 12-22-2025 10:39 AM | |
| 1 | 01-20-2026 04:04 AM |
| Online Status |
Offline
|
| Date Last Visited |
13 hours ago
|