Created feature class has invalid extent

2101
10
12-14-2011 09:44 AM
BruceKessler
New Contributor
Hi all,

I used the following code to create a feature class from an Excel table, then project it. It appears in the geodatabase as a feature class having a valid coordinate system. BUT, when I try to project the data, I get an "invalid extent" message.

Additionally, I cannot overlay these features on base data (no projection on the fly) and if I just have this feature class in a data frame, I can view it fine, but cannot zoom to, say, two of the features. There must be a fine detail I'm missing. Can you help, please?

BTW, I've tried CopyFeatures_management instead of FeatureToPoint_management and it works the same.

Here's some added info: I just tried to edit the feature class I made (just for fun). I cannot interactively select and move any one of the features. This indicates to me that I've not defined some basic parameter for the feature class and it's really confusing ArcGIS.

Here's the code:

# Import modules
import arcpy

# Set local variables
dataDir = "c:\\data"
outWksp = "c:\\data\\assessors.gdb"
proj = "GEOGCS['GCS_WGS_1984',DATUM['D_WGS_1984',SPHEROID['WGS_1984',6378137.0,298.257223563]],PRIMEM['Greenwich',0.0],UNIT['Degree',0.0174532925199433]]"

outproj = "PROJCS['NAD_1983_StatePlane_Idaho_West_FIPS_1103_Feet',GEOGCS['GCS_North_American_1983',DATUM['D_North_American_1983',SPHEROID['GRS_1980',6378137.0,298.257222101]],PRIMEM['Greenwich',0.0],UNIT['Degree',0.0174532925199433]],PROJECTION['Transverse_Mercator'],PARAMETER['False_Easting',2624666.666666666],PARAMETER['False_Northing',0.0],PARAMETER['Central_Meridian',-115.75],PARAMETER['Scale_Factor',0.9999333333333333],PARAMETER['Latitude_Of_Origin',41.66666666666666],UNIT['Foot_US',0.3048006096012192]],VERTCS['NAD_1983',DATUM['D_North_American_1983',SPHEROID['GRS_1980',6378137.0,298.257222101]],PARAMETER['Vertical_Shift',0.0],PARAMETER['Direction',1.0],UNIT['Meter',1.0]]"

outtrans = "NAD_1983_To_WGS_1984_1"

# Set workspace
arcpy.env.workspace = outWksp
   
# Process one Excel file
inEfile = dataDir + "\\Fires1.xlsx\\Sheet1$"
arcpy.MakeXYEventLayer_management(inEfile, "X", "Y", "testLayer", proj)
arcpy.FeatureToPoint_management("testLayer", "TestFC")

arcpy.Project_management("testFC", "TestFCProj", outproj, outtrans)
Tags (2)
0 Kudos
10 Replies
MathewCoyle
Frequent Contributor
Did you check to make sure your point layer you create has the projection referenced correctly?

I would try referencing the projection files directly, rather than copying them into your code.
CSwgs84 = install_dir+r"\Coordinate Systems\Geographic Coordinate Systems\World\WGS 1984.prj"
0 Kudos
BruceKessler
New Contributor
Thanks for the suggestion, Mathew. I still get the following error:

  File "C:\Program Files\ArcGIS\Desktop10.0\arcpy\arcpy\management.py", line 4927, in Project
    raise e
ExecuteError: ERROR 999999: Error executing function.
invalid extent for output coordinate system
Failed to execute (Project).
0 Kudos
MathewCoyle
Frequent Contributor
May be obvious, but are you sure your data is in valid lat/long format? Negative to account for western hemisphere? If you could post your source table, that might help.
0 Kudos
BruceKessler
New Contributor
Mathew,

Yep, I thought of that. I even reduced the xy coordinates to only 2 points and no extra attributes (for testing). Basically the table looks like this:

X               Y
46.447409  -116.856681
46.469863  -116.602003

Since yesterday I've determined that it's not the Excel file that's causing the problem. I've tried dbf and tables within my geodatabase. I've tried Copyfeatures_management as well. I've tried writing the new feature class out to a shapefile first. I've tried not defining the projection in the MakeXYEvent, then defining the projection afterwards. I've tried writing the new feature class into a Feature Dataset that already has a state plane projection defined (and BTW, projection on fly does NOT happen).

Additionally, I've tried doing this all in ModelBuilder as well as Python. I get the same error message every time (well, after I debug any typos, etc. from each change).

So here's what I've come up with. I think the MakeXYEvent  or FeaturetoPoint is somehow not setting the extent. The error comes from the Project tool and says the output extent is bad. My assumption is that the input extent is corrupt (as there is no way to set the output extent in the Project tool) and that is what is making the program blow.

I'm now getting frustrated! Is there a MakeExtent function??? (Guess I'll take a look.)

Why isn't there a tool that does simply what the right-click in ArcCatalog does???? That would be so simple. AND I think this might be a tool used by many.
0 Kudos
MathewCoyle
Frequent Contributor
Well if that is what your data actually is you have a pretty simple problem, you have your X and Y points reversed.
0 Kudos
BruceKessler
New Contributor
Well if that is what your data actually is you have a pretty simple problem, you have your X and Y points reversed.


OMG!!!! LOL. (I have other shorthands to add, but they aren't acceptable here.)

Thank you! Program works fine. WHAT A NOVICE ERROR!

Guess that's what happens when you don't look at the obvious.

It's just amazing what a latitude of -116 does to ArcMap!

Ok. I'm better now.

Thank you for following my trail into oblivion!
0 Kudos
TimothyColgan
New Contributor
I read your post during a search for the same problem with one exception, every time I use the MakeXYEvent tool in ArcMap it places my point and it adds 5 decimal degrees west and 1 decimal degree south to my longitude and latitude decimal degrees which I have set up in an xls file. I've used google maps to double check the lat/long, I've set the coordinate system the same as my map layer, and I still get the same added decimal degrees. Anybody got any suggestions as to what I may try next.
0 Kudos
MathewCoyle
Frequent Contributor
Try making your XY event in a blank mxd then export it as a shapefile with WGS coordinate system and add that to your map to see if it lines up. Make sure you are using the correct geographic transformation if your map layer uses a different coordinate system.
0 Kudos
TimothyColgan
New Contributor
Thank you, that worked 😄
0 Kudos