I'm trying to spatialise a table of 400 polygons (MapInfo tab layer) all of which are adjacent to each other into a SQL Server 2012
database. There are no polygons within polygons etc.
I want one row per polygon but I can only generate one row for all 400. I have the WKT
and a sample of the code I'm using is:
select geometry::STGeomFromText('MULTIPOLYGON( ((319621.99946835
110837.002493295, 319640.501385461 110850.59860145, 319695.199120806
110879.700271183, 319728.303041127 110879.300385649, 319752.898058391
110876.501186912, 319767.401120868 110872.702274339, 319786.199860179
110873.60201679, 319789.102121686 110887.897924629, 319792.103323927
110898.504888418, 319794.29651018 110916.299794679, 319812.699486557
110940.202952471, 319621.99946835 110837.002493295)),
((319910.700282805 110880.699985018, 319916.900568753
110861.595453633, 319941.602771812 110838.00220713, 319973.601853945
110866.004191645, 320000.002539591 110899.404630869, 320025.999217243
110931.295502202, 320034.301993772 110944.001865043, 320038.696611339
110948.600548684, 319910.700282805 110880.699985018)))', 4326)
I hope I don't have to do this 400 times!
select geometry::STGeomFromText('POLYGON((319621.99946835
110837.002493295, 319640.501385461 110850.59860145, 319695.199120806
110879.700271183, 319728.303041127 110879.300385649, 319752.898058391
110876.501186912, 319767.401120868 110872.702274339, 319786.199860179
110873.60201679, 319789.102121686 110887.897924629, 319792.103323927
110898.504888418, 319794.29651018 110916.299794679, 319812.699486557
110940.202952471, 319621.99946835 110837.002493295))', 4326)
select geometry::STGeomFromText('POLYGON((319910.700282805
110880.699985018, 319916.900568753 110861.595453633, 319941.602771812
110838.00220713, 319973.601853945 110866.004191645, 320000.002539591
110899.404630869, 320025.999217243 110931.295502202, 320034.301993772
110944.001865043, 320038.696611339 110948.600548684, 319910.700282805
110880.699985018))', 4326)
Currently the data is in a SQL Server 2005
database but we are migrating to SQL Server 2012
soon.
In the future, the business will make changes to only certain sections of the layer and then I would hope to just spatialise those changes.
As spatial functions are not native to SQL Server 2005
stack, I have SpatialWare
from MapInfo
that did this for me via it's EasyLoader
utility but in SQL Server 2012
, because the spatial functions are now native, MapInfo
is only spatialising the centroids of the polygons. Otherwise this would be the easiest and preferred option.
If anyone could tell me how I can use MapInfo
to spatialise the table so I get all 400 rows or alternativley, the correct SQL
, I'd be most grateful.