Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # SQL Server
- Create some simple tables in SQL Server for testing, no heterogeneous tables here, just ordinary point and line for now.
- CREATE TABLE point_table (
- shapeid int identity(1,1),
- shapename varchar(32),
- shapegeom geometry
- );
- INSERT INTO point_table (shapename, shapegeom) VALUES
- ('Point #1', geometry::STGeomFromText('POINT(13 10)', 2199)),
- ('Point #2', geometry::STGeomFromText('POINT(7 12)', 2199))
- );
- CREATE TABLE line_table (
- shapeid int identity(1,1),
- shapename varchar(32),
- shapegeom geometry
- );
- INSERT INTO line_table (shapename, shapegeom) VALUES
- ('Line #1', geometry::STGeomFromText('LINESTRING(13 10, 7 12)', 2199)),
- ('Line #2', geometry::STGeomFromText('LINESTRING(7 12, 5 5)', 2199))
- );
- # OGR2OGR
- cd C:\OSGeo4W64\bin
- ogrinfo -al "MSSQL:Server=DESKTOP-E5J657H\SQLEXPRESS;Database=SpatialDB;Uid=rkhan;tables=line_table;trusted_connection=yes;"
- ogr2ogr \
- -f "PostgreSQL" \
- -overwrite \
- "PG:host=127.0.0.1 user=postgres dbname=gis password=paresh1234" \
- "MSSQL:Server=DESKTOP-E5J657H\SQLEXPRESS;Database=SpatialDB;Uid=rkhan;trusted_connection=yes;" \
- -lco GEOMETRY_NAME=geom \
- -lco DIM=2 \
- -lco FID=pk \
- line_table
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement