Skip to main content

Hello,

I noticed while migrating some Shapefiles to MSSQL Spatial that there's a Geom column which is added. In which format it is encoded ? And does it countain all the spatial data required informations to restore and draw all the stored features ?

thank you

The GEOM column is the default name for the geometry (point, line, area etc) that is stored in a spatial table.

The format it is stored in depends on the spatial database.

You can specify an alternative name for the column in the writer parameters.


If you look at the table definition in e.g. MS SQL Server Management Studio, you'll most proabably see that the column is of type "geometry", which is the native data type for geometry objects in SQL Server.

More info here:

https://docs.microsoft.com/en-us/sql/t-sql/spatial-geometry/spatial-types-geometry-transact-sql?view=sql-server-2017

If you're using an ArcGIS Geodatabase extension on top of SQL Server, things gets more complicated, see the bottom two paragraphs here:

https://pro.arcgis.com/en/pro-app/help/data/geodatabases/manage-sql-server/sqlserver-spatial-types-and-arcgis.htm


If you look at the table definition in e.g. MS SQL Server Management Studio, you'll most proabably see that the column is of type "geometry", which is the native data type for geometry objects in SQL Server.

More info here:

https://docs.microsoft.com/en-us/sql/t-sql/spatial-geometry/spatial-types-geometry-transact-sql?view=sql-server-2017

If you're using an ArcGIS Geodatabase extension on top of SQL Server, things gets more complicated, see the bottom two paragraphs here:

https://pro.arcgis.com/en/pro-app/help/data/geodatabases/manage-sql-server/sqlserver-spatial-types-and-arcgis.htm

Thank you for the answer

 

Is it encoded in WKB in case of MSSQL ?

 

 


Thank you for the answer

 

Is it encoded in WKB  in case of MSSQL ?

 

 

The geometry is encoded in a format native to SQL Server, as far as I know.

 

But you can cast the geom column to OGC WKB if you need, e.g.

 

select geom.STAsBinary() from my_table
See also: https://docs.microsoft.com/en-us/sql/t-sql/spatial-geometry/stasbinary-geometry-data-type?view=sql-server-2017

Reply