Thank you for your time. None of the articles is helpful. My value in the table looks like { "type": "MultiPolygon", "coordinates": [ [[[102.0, 2.0], [103.0, 2.0], [103.0, 3.0], [102.0, 3.0], [102.0, 2.0]]], [[[100.0, 0.0], [101.0, 0.0], [101.0, 1.0], [100.0, 1.0], [100.0, 0.0]], [[100.2, 0.2], [100.8, 0.2], [100.8, 0.8], [100.2, 0.8], [100.2, 0.2]]] ] }
your array of arrays in your FeatureJSON column will be very hard to work with in SQL Server. It will require a lot of parsing. I am not sure SQL is the best place to do that.
Lets get the ball rolling with at least the following.
;with src
as
(
select x.*
from #ZoneFeature z
cross apply OPENJSON(z.FeatureJSON) x
)
select *
From src
where type = 4
--the sampling of long lats are coming from your FeatureJSON column which I manually stripped of the brackets.
Declare @polygon geometry
SET @polygon = geometry::STGeomFromText('POLYGON ((102.0 2.0, 103.0 2.0, 103.0 3.0, 102.0 3.0, 102.0 2.0))', 4326)
select @polygon
Will this be a one time migration to port this json to geometry?