Importance of Zoom Parameter
Displaying too much data when a map is zoomed out takes too long. The zoom level controls of DB2Vector provide a solution.
A web map will display all of the data that corresponds to the region shown in the browser. Often this is too much data to transmit and render quickly, and often it would not even make sense to view lots of data when the map is zoomed far out.
We've made an example of this using a dataset for electrical transmission lines for the United States that we obtained from NERC.
WITH boundingbox AS(
SELECT
ST_MakeEnvelope(
%(xmin)s,
%(ymin)s,
%(xmax)s,
%(ymax)s,
3857
) AS geom
),
mvtgeom AS (
SELECT
ST_AsMVTGeom(
ST_Transform(sourceTable.geom, 3857),
boundingbox.geom
)
FROM
demo.transmission_lines sourceTable,
boundingbox
WHERE
ST_Intersects(
ST_Transform(boundingbox.geom, 3857),
sourceTable.geom
)
)
SELECT
ST_AsMVT(mvtgeom.*)
FROM
mvtgeom;
DB2Vector has a minimum and maximum zoom bounds so that a query is only made for data when the browser is within the range of the minimum and maximum zoom. When displaying very dense data, if the minimum zoom level is set properly, the viewer can zoom in and the data will load quickly. When the viewer zooms out, only the basemap is displayed, and so the view can quickly pan to a new area of interest and then zoom in again. This reduces the amount of time a view spends waiting for data to load.
The default setting is currently ten, which will generally prevent a query being made that call too much data. For many datasets, a lower zoom level is fine. You can adjust this easily in the DB2Vector user interface.
The example below shows the US electrical transmission lines.