Spatial reference extent limitations ?

2628
14
Jump to solution
07-16-2018 06:40 PM
TieshengWu
Occasional Contributor

I would like to get features spatial reference limitations of coordinate x and y  by using snippet like:

sr = arcpy.Describe('my feature').spatialReference

dom=sr.domain.split()
xmin=float(dom[0])
ymin=float(dom[1])
xmax=float(dom[2])
ymax=float(dom[3])

...

But it seems don't  work. For  a WGS84 GCS, the result is xmin=-180, xmax=180, ymin=-90 but ymax=270 rather than 90, and more strange result for a  WGS84 PCS. Does sr.domain is not proper for my needs?

0 Kudos
14 Replies
JoeBorgione
MVP Emeritus

That's what I've come up with: I created a polygon based on the extent of the county.  It's the automation part that fails: the RecalculateFeatureClassExtend_management() method only takes one argument and that's the feature class itself.  If it were to take 5 (name, xmin,ymin,xmax,ymax) I'd be golden!


					
				
			
			
				
That should just about do it....
0 Kudos
MelitaKennedy
Esri Notable Contributor

It's pulling the spatial reference xy domain which is square. The lower left / minimum values are good, but the max values may be blown out to either make the extent square or to make the xy resolution value a reasonable number. 

The -400 is to cover data that could be in -360 to 0 longitude range, with a very generous buffer added. We just used the same value for the minimum Y (latitude) value too. 

-400 -400 1000000000;-100000 10000;-100000 10000;8.98315284119522E-09;\
               0.001;0.001;IsHighPrecision"

These values are (in order):

minimum X, minimum Y, inverse of xy resolution;

minimum Z, inverse of Z resolution;

minimum M, inverse of M resolution;

XY tolerance;

Z tolerance;

M tolerance

True that the spatial reference is high precision versus the original "basic" precision.

The tolerance values are actually not good if the data is using a geographic coordinate system.

Wu Teshieng, you probably want the coordinate system's "projected horizon" but I don't think that's exposed in arcpy. Here's some of the methods in ArcObjects:

https://desktop.arcgis.com/en/arcobjects/latest/net/webframe.htm#iprojectedcoordinatesystem4_getpcsh... 

The PCS horizon but in latitude/longitude. It is not guaranteed to be an inclusive horizon (it might be exclusive to show which part of the world can't be 'seen' in the particular PCS).

https://desktop.arcgis.com/en/arcobjects/latest/net/webframe.htm#iprojectedcoordinatesystem2_gethori... 

TieshengWu
Occasional Contributor

Thanks for your instruction Melita. Yes, what I want is exactly the valid area of  a coordinate system, so i know now it's called 'project horizon' (but a GCS also have a limit boundary by longtitude and latitude for -180 to 180 and -90 to 90 degree ).  It's a pity that arcpy can't retrieve this value. Can i insert ArcObject codes in arcpy to get it? 

0 Kudos
MarcoBoeringa
MVP Regular Contributor

    Melita Kennedy schreef:

    It's pulling the spatial reference xy domain which is square. The lower left / minimum values are good, but the max values may be blown out to either make the extent square or to make the xy resolution value a reasonable number.

Melita Kennedy,

Could these specific traits of the "domain" properties of a Spatial Reference be better documented on the Help page of the Spatial Reference?


I was running into a similar issue, where calling:


spatialRefDomain = spatialRef.domain
arcpy.AddMessage("spatialRefDomain: " + spatialRefDomain)

to inspect the extent's values, resulted in rather un-expected max values (spatialRefDomain: -20037700 -30241100 900699887774,099 900689684374,099), as I didn't realize these were related to the XY resolution of the dataset. The first impression of the "domains" is that they represent something like the "projection horizon" you mentioned, but your explanation makes clear they are something entirely different. I think the difference must be cleared up in the Help page of the Spatial Reference as well by adding extra documentation. The current page is rather minimal in explanations (although it is comprehensive in mentioning all properties). It probably could use some graphics as well to give some visual impression of these properties.

0 Kudos
MarcoBoeringa
MVP Regular Contributor

Actually, adding the "Note" text mentioned on the

Recalculate Feature Class Extent—Help | ArcGIS Desktop 

Help page thatJoe Borgione‌ pointed out and that mentions the difference between domains and extents, to the Spatial Reference Help page, would already be a big win.

0 Kudos