Select to view content in your preferred language

Convert Lat/Longs to Blob/Shape-thing

1755
11
08-09-2019 12:32 PM
EricThomas3
New Contributor II

I'm trying to POST lat/longs to a database that feeds Portal. My GIS guy says I need to convert the lat/longs to a "Blob/Shape" as shown below. 

1. What is this Blob/Shape-thing?

2. How do I programmatically convert Latitude and Longitudes to this Blob/Shape-thing WITHOUT using ArcGIS desktop or Python?

Is there an API / service somewhere that does this?

Thank you


Example:

Convert FROM

35.649783386

TO 

01012d1d003b2d1d0d0000000001000080ded0e3bd188098bb97e013003130310d040000c0050190d9493141a062da26da214841c0050190d9493141a062da26da2148410000000000408fc00000000000408fc03130300000040d413149d9900105c0414821da26da62a0413149d9900105c0414821da26da62a0c08f400000000000c08f400000000000
0 Kudos
11 Replies
JoshuaBixby
MVP Esteemed Contributor

I really hope some of the terminology from your "GIS guy" was lost in translation and that he isn't saying "blob/shape" because that is sufficiently vague to mean many things and nothing.  Ask your GIS guy what spatial format, specifically, he can work with if not text-based coordinates.  Also, are you just working with points?

EricThomas2
New Contributor II

Hi Joshua Bixby‌, thanks for the quick reply. 
Yes, only points.

As far as I know, we work with whatever format this thing is:

01012d1d003b2d1d0d0000000001000080ded0e3bd188098bb97e013003130310d040000c0050190d9493141a062da26da214841c0050190d9493141a062da26da2148410000000000408fc00000000000408fc03130300000040d413149d9900105c0414821da26da62a0413149d9900105c0414821da26da62a0c08f400000000000c08f400000000000

Do you have any details on what exactly this is?

0 Kudos
JoshuaBixby
MVP Esteemed Contributor

For starters, 35.649... isn't a complete coordinate, it is just a number.  I have a hard time believing that long hex string is the direct translation of 35.649....  But beyond that, I am not going to start guessing spatial data structures.  Your GIS guy really just needs to tell you what it is, and if he can't then he isn't really a GIS guy.

0 Kudos
EricThomas2
New Contributor II

Hi Joshua, 

Do you know what the long hex string represents?

Is it a "spatial data structure"?

If so, where are these referred to in the ESRI docs?

0 Kudos
DanPatterson_Retired
MVP Emeritus

It is Friday and the GIS guy could be messing with you

0 Kudos
EricThomas2
New Contributor II

We have good guys . Not worried about them messing with me. Do need to know what these strings represent and how I can convert Lat/Longs appropriately without using ArcGIS Desktop or Python.

0 Kudos
JoshuaBixby
MVP Esteemed Contributor

Not to belabor the point, but why don't your GIS guys tell you what spatial data format that is?  Why do you, or any of us, have to guess?  There are numerous binary spatial data formats, so a simple hex string isn't definitive in terms of what format it represents.

As an example, take a coordinate for my hometown in WKT format:  'POINT(-92.139 46.807)'.  That point in SQL Server in native Geography spatial is 0xE6100000010C9EEFA7C64B67474037894160E50857C0 while that same point in WKB format is 0x010100000037894160E50857C09EEFA7C64B674740. 

EricThomas3
New Contributor II

Ok. Looks like the spatial data format is: DB2 ST_Point format stored in a BLOB field.

So back to the original question: How do I convert Lat/Long text pairs to this format without ArcGIS desktop or Python?

Thank you

JoshuaBixby
MVP Esteemed Contributor

Knowing it is DB2 helps.  All databases with native spatial types include a range of geometry constructors that support common spatial data interchange formats, e.g., WKT, WKB, maybe GeoJSON, maybe GML, etc....  You should not have to generate the native spatial blob itself, simply pass one of the common spatial data interchange formats to the DBMS geometry constructor.  See ST_Geometry function - DB2 - IBM Knowledge Center .