• Blog posts


    By David Crowther



    Why does my MapThat layer render slowly?


    There are several tips and tricks to get your MapThat layers to render as quickly as possible –

    • Use WMS layers to render heavy spatial polygons layers
    • If using spatial layers, ensure you have a spatial index applied to the table
    • Only display heavy spatial layers at suitable zoom levels etc….

    However, as a rule you should be able to display spatial data in MapThat within 1-2 seconds even if there are 2-3000 polygon features rendering in the map.

    But what can cause spatial layers to render more slowly than expected?

    There are likely two reasons!

    1 – COMPLEX spatial geometry

    A spatial MapThat layer may well show as expected (1-2 seconds) when you pan or zoom in most areas. However, if you find the map becomes unresponsive, it may well be because a VERY COMPLEX polygon feature is trying to be drawn in the new map extents. For example, this could be a very complex spatial polygon from the Coal Authority, which could be complex multi geometry objects.


    It would instead be recommended that such complex spatial layers are published using GeoServer as a WMS.

    2 – Incorrect (or missing) Spatial Index

    If you have a spatial layer that doesn’t have complex geometry and is unresponsive or slow when trying to render a smaller number of records – the likely cause is either a missing spatial index or incorrect spatial index on the source table.

    Follow this FAQ to learn how to create a spatial index on your source tables – remember all geometry database tables should have a spatial index!


    However, even if your source table has a spatial index, ensure that you check that the spatial index is valid!

    At the Table level, choose the Spatial Index and select Drop and Create to…New Query Window


    … the spatial index will be detailed in a new query window, where we can see the extents of the index.


    So, we have a Spatial Index, but is it correct?.... well, if your layer is rendering slowly in MapThat and even rendering slowly as a WMS via GeoServer, then it’s likely there is an issue with the spatial index.

    We would recommend that you re-check the spatial extents for your data running the following query…

    select min(geometry.STEnvelope().STPointN(1).STX), min(geometry.STEnvelope().STPointN(1).STY),
    max(geometry.STEnvelope().STPointN(3).STX), max(geometry.STEnvelope().STPointN(3).STY)
    from YOUR TABLE


    And then update the Spatial Index in the Query Window to drop and recreate the spatial index using the corrected extent values.


    Note – if your spatial table updates regularly and includes data for new geographic regions, you should keep your spatial index updated accordingly.

    With the correct Spatial Index on your table, the MapThat Spatial layer and any WMS version of that layer will now render as quickly as expected.



Please sign in to leave a comment.