I have downloaded bathymetric data but the submarine contours - at 10m intervals - have gaps. Many gaps - the -10m (submarine) contour has over 700 gaps. So I need a programmatic way of either dealing with the gaps i.e. connecting the neighbouring endpoints and thus filling them in; or a way of highlighting the end points of each part so that I can find them and go to them. But I would assume that if I can identify the endpoints of each part, then it should be possible to programmatically connect the two endpoints that are closest together. Unfortunately I do not have the original tif file that the contours came from, nor do I know whence it came. The area I am looking at is offshore SW Ireland to a depth of about 150 m.


Here is the image of the MAPZEN of SW Ireland exported into QGIS - note the high numbers for max and min.

Here is an image of an example of the original gapped contour problem

enter image description here

And this image shows what I get when I drag Mapzen into the layers panel. Not much, unless I switch to hillshade. enter image description here


2 Answers 2


Probably easier, faster and less error prone than converting lines full of gaps is to recreate the lines from a Digital Elevation Model (DEM). In newer QGIS versions, you have pre-installed Mapzen Global Terrain DEM raster connection under XYZ tiles. This includes submarine terrain/elevation (bathymetry) as well, see:

enter image description here

You can create contours as layer styling, without even downloading anything. Like this, you create contours for visualization only in a few seconds:

enter image description here

If you want to have your contours as separate vector layer, you can download the extent of the data you need from the Mapzen Global Terrain raster layer (right click layer > export) and then locally convert to contours or contour polygons.

Downloading Mapzen Global Terrain to a local GeoTIFF raster file: enter image description here

Locally downloaded extract of the Mapzen Global Terrain dataset as raster layer and contoour polygons from this raster with one polygon selected (highlighted in yellow):

enter image description here

  • I didn't know this was available. So I connected fine and got the data - but the data range - min and max - are big numbers and do not appear to relate to realistic depths - up in the 800,000 area. I had this same issue with tiff files I downloaded from EMODNET, and the resultant contours were pretty awful. May 22 at 16:45
  • You can manually set min/max value, see first screenshot. Value of 800,000 however seeems strange - can you post a screenshot?
    – Babel
    May 22 at 16:47
  • How do I post a screenshot? I do not get a download of the MAPZEN like above. Maybe it is my internet connection being too poor.... May 22 at 17:42
  • Edit your question, post the screenshot there. You could also copy the link from there, close edit without saving and then paste the link here in the comments
    – Babel
    May 22 at 18:24
  • 1) Drag&drop Mapzen to layers panel, 2) right-click Mapzen in layers panel, 3) select export
    – Babel
    May 22 at 18:26

You can

  1. Create start and end points with geometry by expression and the expressions start_point($geometry) and end_point($geometry)
  2. Then connect these with Shortest line between features with a Maximum distance of just above your gap distance.

enter image description here

I dont know what your end goal is but you can merge the output with your contours, then dissolve by depth/height field.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.