Determine spatial reference from X,Y values

445
3
03-15-2012 09:30 AM
sapnas
by
Occasional Contributor III
I'm looking for a sample code that would assist me to determine the spatialreference of the point created using x,y values. Setting the spatialreference property of the point does not change the x,y values.
0 Kudos
3 Replies
NeilClemmons
Regular Contributor III
What are you trying to do?  There's no way to determine a spatial reference given a set of x,y coordinates because the range of x,y values are not unique to a particular spatial reference.  In other words, you can't say that because my point has coordinates 0, 0 that it is in the Nad 83 Utm Zone 18N spatial reference because a point whose coordinates are 0, 0 could be in any spatial reference.

"Setting the spatialreference property of the point does not change the x,y values. "  This is correct.  When you set the SpatialReference property on a point object you are specifying the spatial reference of the point, not performing any kind of transformation.  If you want to project the point from one spatial reference to another then you should be calling the Project method.  The point object will need to already have a spatial reference set on it before calling Project.
0 Kudos
sapnas
by
Occasional Contributor III
Thanks for the response Neil!
I'm implementing a utility that reads x,y values from a flat file create points, transform and add it to wgs_1984 shapefile. I believe the x,y values has to be restored to its original spatial reference inorder  to transform it to WGS_1984.  The flat file does not have any spatialreference, projection or coordinate  system details. hence I was curious if I can determine these properties from x,y values.
0 Kudos
NeilClemmons
Regular Contributor III
Yes, in order to project the data into a specific spatial reference you have to know what spatial reference it's in to begin with.  That's something that will have to be provided for you, not something that you can determine based on just the coordinate values you have.
0 Kudos