How can I convert lat/long pairs to SDEBinary?

241
5
02-15-2018 02:12 PM
MatthewSanders1
New Contributor III

How can I convert lat/long pairs to SDEBinary using Python?

I was tasked with migrating data from one database (DatabaseA) to another (DatabaseB). DatabaseB and DatabaseA are formatted completely differently. DatabaseA represents everything using lat/long pairs, while DatabaseB uses SDEBinary to represent geodata.

I am working on a Python script to pull data from DatabaseA and insert it directly into DatabaseB using SQL. How can I convert the lat/longs on-the-fly into SDEBinary?

The link below is helpful in understanding how values are represented using Esri Binary spatial type (SDEBinary) but I hope to avoid writing a comprehensive conversion module for such a simple task.

http://edndoc.esri.com/arcsde/9.2/concepts/geometry/representations/compressed.htm#Physical

Thanks in advance for any help!

Tags (1)
0 Kudos
5 Replies
MelitaKennedy
Esri Notable Contributor

Does ArcGIS see Database A as geographic data? If it doesn't, one possibility would be to write that data into a shapefile, then import the shapefile in the SDE database--let the software do the conversion to SDEbinary.

There's likely another way to grab the coordinates from DB A, make a geometry and then write that to DB B, but I would expect it to be relatively slow.

0 Kudos
VinceAngelo
Esri Esteemed Contributor

Shapefile is an awful format for database-to-database conversion. Recommend file geodatabase instead, since FGDB won't lose date resolution, numeric nulls, wide tables, UTF-16 strings, wide strings, legible field names,....

MatthewDobson
Occasional Contributor

Matthew, have you tested the  FeatureClassToFeatureClass tool? While slower than the SQL option, it may do all the heavy lifting for you.

0 Kudos
VinceAngelo
Esri Esteemed Contributor

We'll need more information than a link to archaic documentation.  Of critical interest:

  • The RDBMS and version of the source database
  • The RDBMS and version of the target database
  • The geodatabase version of the target database

There are no tools to use pure Python to populate SDEBINARY geometry without ArcPy. Attempting to do so will cost far more than a seat of Desktop (and if the database is already SDEBINARY, then the software already exists).

- V

JoshuaBixby
MVP Esteemed Contributor

Matthew Sanders‌, is this question addressing the same question you ask How do I create and add SDEBINARY points to database? or is it a follow-up?  If a follow-up, please mark a comment as "Correct" on the other discussion to close it out.  If this is the same question, pursuing the original discussion usually works better than cross-posting the same question in a slightly different way.

If you are going to be populating data as SDEBINARY, then you are obviously working with an enterprise geodatabase.  The most straightforward approach here would be using Xander Bakker‌'s suggestion in the other discussion and work with XY event layers.

If you want to Workflow: Create tables with SQL and register them with the geodatabase—Help | ArcGIS Desktop , you aren't going to be able to work with SDEBINARY.  There are others that have already touched on this, but there is no way to make DBMSes "aware" of SDEBINARY like ST_Geometry.  SDEBINARY is simply a binary field to the underlying DBMS.