I have three ESRI feature classes (POINT, LINE and POLYGON) that contain a geometry datatype column with data in a projected coordinate system. I'm looking for a way that I can convert & project from Geometry datatype to Geography.

Does anyone know of a tool or script I can use to convert all records permanently?

My research has show that I will not be able to do this with a simple SQL statement. So i'll probably need to use an Arc Toolbox or Python script or something.

  • 1
    I would urge you to try to fashion a SQL statement, since there's no reason this won't work for data which doesn't violate Microsoft's hemisphere rules. – Vince Sep 1 '15 at 20:23
  • I've tried. The Geometry data needs to be projected. It's in X,Y, not lat, long. If you how to project geometry data in SQL, please enlighten us. – CaptDragon Sep 1 '15 at 21:06
  • It's trivial in everything but Microsoft. Please edit the question to mention that the data is in a projected coordinate system. – Vince Sep 1 '15 at 21:34
  • @Vince, Agreed, any work around ideas or tools? – CaptDragon Sep 1 '15 at 21:44
  • The question devolves to "How do I deproject a PCS feature class to a GCS feature class with MS-SQL Geography storage?" The answer is to project and use an appropriate DBTUNE keyword in the target workspace. – Vince Sep 1 '15 at 22:07

You could always do the conversion on the fly by casting the geometry object to a geography object. For example:

SELECT geography::STGeomFromText(SHAPE.ToString(),4326) FROM featureclass;
|improve this answer|||||

You can try to copy into SDE Binary in ArcCatalog, and then to geography from there.

|improve this answer|||||
  • I'll try that right now. I had tried going directly to geography and it didn't let me, I think you're on to something though. – CaptDragon Sep 1 '15 at 19:19
  • There's no reason to go through SDEBINARY storage -- A new feature class in Geography native format is a simple table copy. In fact, it can be done through SQL as well. – Vince Sep 1 '15 at 20:20
  • Well, I'm half way there. ArcCatalog will allow me to conver to SDE Binary (ofcourse) but not to Geography from there. imgbin.org/images/25788.png – CaptDragon Sep 1 '15 at 21:08

Here is a potential workflow that will work provided that all data sets are properly defined with regards to projection/coordinate system:

  1. Create new feature classes with the projection you want to migrate to. Be sure to use the geography keyword when creating them. You can import the table field structure from the old feature classes to simplify the process.

  2. Use ArcCatalog or arcpy to import features from your existing feature classes into the new feature classes that have the geometry data type and are in the SRID that you want. If you matched the data structure from the existing feature classes, this should be straight-forward either using the Data/Load Data from ArcCatalog or Append_management from arcpy ("NO_TEST" option).

  3. Rename or archive your old feature classes. Be sure to back them up, just in case something goes wrong.

  4. Rename the new feature classes to assume the former name of the old feature classes. This is useful if you have projects that reference the prior data sets. This step is not necessary if this if you don't have existing work built around the old data.

This is not a simple, run one script approach but it seems to meet the requirements. Also, each step of the process can be coded into arcpy scripts if you need to repeat this process in the future or apply it to many other data sets.

|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.