问题:将shapefile(.shp)插入sql server
步骤:
1 - 我使用Geokettle将.shp转换为sql server查询
2 - 我使用sql查询在sql server中创建表
SQL Server代码如下:
INSERT INTO [dbo].[CARGA_SHAPE](the_geom, STATEFP, COUNTYFP,
COUNTYNS, AFFGEOID,
GEOID, NAME, LSAD, ALAND, AWATER)
VALUES (MULTIPOLYGON ((
(-83.35353099999999 39.197585,
-82.78589099999999 39.168769,
-82.80709 38.948073,
-83.04361999999999 38.956939,
-83.212107 38.960148,
-83.270817 39.015791,
-83.314589 39.052195,
-83.385637 39.055197,
-83.35353099999999 39.197585)
)),
'39','131',
'01074078','0500000US39131',
'39131','Pike',
'06',1140324458,
9567612);
INSERT INTO dbo.CARGA_SHAPE(the_geom, STATEFP, COUNTYFP, COUNTYNS, AFFGEOID,
GEOID, NAME, LSAD, ALAND, AWATER)
VALUES (MULTIPOLYGON (((
-98.807771 43.935223, -98.331508
43.937708, -98.331544
43.868189, -98.32524199999999
43.851057999999995, -98.320595
43.498650999999995, -98.705782 43.499319,
-98.79458799999999 43.499187,
-98.796965 43.848575, -98.807771
43.935223))),
'46','003',
'01266983','0500000US46003',
'46003','Aurora',
'06',1834813753,11201379);
但我收到错误消息:
Message 102, Level 15, State 1, Line 1
Incorrect syntax near '39.197585'-
Message 102, Level 15, State 1, Line 1
Incorrect syntax near '43.935223'-
Message 102, Level 15, State 1, Line 1
Incorrect syntax near '44.855951'-
但是,当我使用Geokettle进行相同的步骤来获取Postgres查询时,它可以正常工作。
我不知道为什么sql server不接受,因为我使用的是2012版本(使用空间工具)。
Postgres代码如下:
INSERT INTO mapa(the_geom, STATEFP, COUNTYFP, COUNTYNS,
AFFGEOID, GEOID, "name", LSAD, ALAND, AWATER)
VALUES (ST_GeomFromText('MULTIPOLYGON (((
-83.35353099999999 39.197585,
-82.78589099999999 39.168769,
-82.80709 38.948073,
-83.04361999999999 38.956939,
-83.212107 38.960148,
-83.270817 39.015791,
-83.314589 39.052195,
-83.385637 39.055197,
-83.35353099999999 39.197585)))'
,-1)
,'39','131','01074078','0500000US39131',
'39131','Pike','06',1140324458,9567612);
INSERT INTO mapa(the_geom, STATEFP, COUNTYFP, COUNTYNS, AFFGEOID, GEOID, "name", LSAD, ALAND, AWATER) VALUES (ST_GeomFromText('MULTIPOLYGON (((-98.807771 43.935223, -98.331508 43.937708, -98.331544 43.868189, -98.32524199999999 43.851057999999995, -98.320595 43.498650999999995, -98.705782 43.499319, -98.79458799999999 43.499187, -98.796965 43.848575, -98.807771 43.935223)))',-1),'46','003','01266983','0500000US46003','46003','Aurora','06',1834813753,11201379);