What is a geometry?

At it's core, a geometry is a one or more coordinates. These may be 2 values: (x, y), 3 values: (x, y, z), or possibly four: (x, y, z, m). For points, there is one coordinate. For lines, there are two or more. For polygons, there are three or more. This, of course, gets more complex when you represent holes in polygons or multipoints, or multipart lines. It can get more interesting with complex types like circular arcs or bezier curves!

What are geometry formats?

When storing geometry, each database system stores them in their own way. ArcGIS uses a propreiatary format that is known only to them. Oracle uses their Oracle Spatial Type. SQL Server uses their Geometry type, and Postgres' PostGIS has it's geometry type. For instance in an ArcGIS enterprise database you can use a Keyword to define which geometry format you want. They have PostGIS, ArcSDE, Oracle Spatial, Microsoft's Geometry, or OGC's WKB.

The binary representation of each of these is very similar, but also different. They can have different precision, they can store the coordinates in different orders, and with different coordinate systems. Since some of these are proprietary and some are open standards, it just depends on which one you have.

How does the GP Tool deal with different formats?

The GP tool is responsible for converting the geometry from the Postgres' PostGIS geometry type to the Geodatabase's geometry type. This is done by deconstructing the geometry using PostGIS' documented geometry type, and reconstructing the geometry using the Geodatabase API's. When doing this deconstruction, we use the binary representations to maintain as many decimal places as possible. In reality, saving a geometry to the geodatabase and back can have differences in and around the 20th decimal point.

What can change when converting formats?

When converting from the Postgis Geometry type to the Geodatabase geometry type, there are several things that can cause changes in the coordinates:

- The precision of the stored number (32 vs 64 bit integers)
- The coordinate system transformation ( InfraMarker is WGS 1984, but your Geodatabase may be something else like NAD 83)
- The resolution of the data (PostGIS' resolution is 0.00001, whereas the Geodatabase after 9.2 is 0.0001)

How much precision is enough?

There is a very good answer here, but basically at 9 decimal places you're sub millimeter in real world coordinates. Beyond 8 decimal points, and you are running into numbers calculated by a gps or computer. A human being can't distinguish between them in the real world. Also, you run into the mathmatical tolerances before you run into issues with losing decimal places.

http://gis.stackexchange.com/questions/8650/measuring-accuracy-of-latitude-and-longitude/8674#8674

So what does it all mean?

This means, you may see changes like this when syncing between the Geodatabase and InfraMarker:

{ "new": { "wkb_geometry": "0101000020E6100000005DF3EDA48A5EC0380BAAC8BDD04740" }, "old": { "wkb_geometry": "0101000020E61000000A5DF3EDA48A5EC0380BAAC8BDD04740" },

}

You can investigate the change by printing out the coordinates in a query:

SELECT ST_ASTEXT( '0101000020E61000000A5DF3EDA48A5EC0380BAAC8BDD04740') as old, ST_ASTEXT('0101000020E6100000005DF3EDA48A5EC0380BAAC8BDD04740') as new

new: POINT(-122.166316497478 47.6307917433064)

You can even mathematically calculate the distance between the two coordinates:

SELECT ST_Distance( '0101000020E61000000A5DF3EDA48A5EC0380BAAC8BDD04740'::geography, '0101000020E6100000005DF3EDA48A5EC0380BAAC8BDD04740'::geography) as distance

distance: 0

Why is the distance 0?

Because, even though these are different coordinates when looking at beyond 15 decimal points, the tolerance of the mathematical functions that calculate distance is no where near that. So they are for all intents and purposes the same point on the world.

But how different are they really?

In reality, that point is accurate to less than a centimeter. Which is accurate enough for any applicable geo workflows. The rest of the coordinates are mathematical calculated values that are maintained to ensure that the math is always within the tolerances of the coordinate system.

## Comments

0 comments

Please sign in to leave a comment.