Reputation: 1268
We have data in our SQL Server of geometry
datatype.
When doing
select shape
from boundary_polygon
I get this result:
I have exported the data from SQL Server from the table shown here. How can I import the same data into postgres with datatype geometry
for the below is the table structure. As the data in the shape
column is in hexadecimal, how to import?
create table boundary_polygon(id int, shape geometry)
Upvotes: 2
Views: 1542
Reputation: 24568
geometry
in sql server is a blob in the CLR Type Serialization Format.
read more about that in Microsoft SQL Server CLR Types Serialization Formats
whereas postgis uses WKB (well known binary) for it's geometry datatype.
in sql server you can convert that format into WKT (well known text) by using STAsText()
method.
read more about it here
so convert your data in sql server to KWT :
select shape.STAsText()
from boundary_polygon
now you can easily insert them in postgis geometry.
Upvotes: 2