• Blog posts



    I would like to speed up the rendering of layers in MapThat, how do I create a Spatial Index in SQL Server?



    Creating a Spatial Index is a must for your spatial datasets, as it will help any client application render your data more quickly and perform spatial analysis easier. In order to create a Spatial Index first you must know the bounding box coordinates of your dataset. To do this you can use this simple SQL statement:Capture2.PNG

    * where ogr_geometry is the geometry column in YOURTABLE

    This will return a result where the Easting and Northing of the bottom left and top right of your data is shown:

     pic8.pngUsing these coordinates you can then use the following SQL statement to create a Spatial Index for the table.Capture3.PNG* ensure you replace the E & N values for the Bounding Box with those you identified in the first query.

    If you now view the list of Indexes for YOURTABLE you can now see that a Spatial Index has been created and will be used to more efficiently render and query your spatial dataset. pic9.png 

    For my help with SQL Spatial data try this FAQ:  https://www.cadlinecommunity.co.uk/hc/en-us/articles/115002814585-MapThat-Admin-Geometry-Make-Valid-Error-Message