Selecting a good SQL Server 2008 spatial index with large polygons

后端 未结 3 1538
梦谈多话
梦谈多话 2020-12-25 08:15

I\'m having some fun trying to pick a decent SQL Server 2008 spatial index setup for a data set I am dealing with.

The dataset is polygons, representing contours ove

3条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-12-25 08:49

    In your index query you use:

    CREATE SPATIAL INDEX [contasplit_sidx] ON [dbo].[ContASplit] 
    (
        [geom]
    )USING  GEOMETRY_GRID 
    WITH (
    BOUNDING_BOX =(-90, -180, 90, 180),
    ...
    

    The BOUNDING_BOX therefore maps to:

    xmin = -90
    ymin = -180
    xmax = 90
    ymax = 180
    
    • Longtitude (-180 to 180 - designating East / West of the Meridian) should map to X
    • Latitude (-90 to 90 - designating how far North or South of the Equator) should map to Y

    So to create the BOUNDING_BOX for the world you should use:

    CREATE SPATIAL INDEX [contasplit_sidx] ON [dbo].[ContASplit] 
    (
        [geom]
    )USING  GEOMETRY_GRID 
    WITH (
    BOUNDING_BOX =(-180, -90, 180, 90),
    ...
    

    This should create an index that fits your data and means all your features are covered by the index.

提交回复
热议问题