# Finding where to close polyline using QGIS technique that resemble how US Census Geography's Inland Water is calculated

Given a polyline is it possible to determine where to close it (to form a polygon) using a single line segment that's no more than 1 nautical mile long while ensuring a maximum polygon area using QGIS?

I am trying to use a geoprocessing operation and parameter to get results similar to the US Census's Inland Water geography. I have some coastlines that I want to apply the same definition of the Inland Water used by the US Census (see GARM Chapter 15, specifically Figure 15-1 @ https://www2.census.gov/geo/pdfs/reference/GARM/Ch15GARM.pdf), but I can't figure out how to do it, specifically how to derive that ≤1 nautical mile line between two points on a given continuous line. In other words basically have the program figure out where should be an inlet and ensure that inlet has the maximum area possible, considering that for the entire length of the inlet there could be multiple location where it could be narrow to ≤1 nml and you'd want the one "furthest out".

If this problem is complicated enough to require any programming/coding I may consider aborting this as I'm not up to my stuff in any CompSci matters; likewise, as I only have 1 college course worth of GIS skill, I realize this question could be more advanced than I hoped and out of my league, so I might not be able to verify/replicate any answer.

But for starter perhaps the coastline should be a polygon object (fake the other line segments crudely?) since there might be a problem using line object such that the GIS might end up working the wrong side of the line so maybe a coastline in polygon format could preempt that.

This is GARM's Fig15-1 with my highlight of what I'm seeking.

so if this was a real coastline how to find the lines highlighted; so finding if this stretch of the "river" have any where that I can close it off with a line of 1 nml maximum and achieve a maximum area (the "maximum area" criteria is there in consideration that there could be, say, a larger-than-1-nml lake upstream)

Note: This question is not about obtaining open/restricted data, and I am not trying to ask US Census to supply details of their methodology; this is about developing a GIS technique to obtain a result similar to the example mentioned (i.e. US Census' GARM Ch15).

• Not possible without the data
– BERA
Sep 28, 2022 at 17:52
• @BERA Can you elaborate on your comment? This question is about how to get the results with any given data, so take your pick of data such as any river mouth coastlines for example. I can provide a sample data of which coastline I had in mind when I asked this question but coastlines of a lot of places could do.
– Leo
Sep 28, 2022 at 22:08
• My guess would be to iterate over the vertices, do a distance matrix, and check if any distance is less than a threshold, needles to say some limitation (direction or ignoring values before a 'peak' would improve the alg.) Sep 29, 2022 at 11:10
• The data has a very deep impact on your question. Do you only have polygons or do you have additional lines for the rivers for examples with a direction componen where one could identify the end? Which attributes are available etc. Oct 5, 2022 at 15:07

Hypothesis

• There is one continues line representing edge of water - both for open waters, and inland water
• The line has known direction, and the water is on the known side in regards of line direction - left (expected if line was extracted from land polygon)
• The start and end of the line are on the open waters edge (not on edge of any inland water areas)
• The inland water closure line is defined as first 1 nautical mile distance between river banks coming from open waters
• The inland water closure line is assumed to be perpendicular to direction of imagined water flow between inland water and open waters
• The inland water is area enclosed by inland water closure line and inland water edge line of defined minimum length
• Islands are ignored

Solution

Inputs: initial line IL; Minimum length of inland water edge line ML

1. Check IL direction for water on the left side, if not use reverse line from Advanced Digitizing Panel
2. Buffer 0.5 nautical mile around IL -> B1
3. Buffer 0.5+0.01 nautical mile around IL boundary (start point and end point) -> B2
4. Polygons to lines on B1 -> BL1
5. Crop (Difference) BL1 by B2 -> BL2
6. Multipart to Singleparts BL2 -> BL3
7. Extract line from BL3 with start point intersecting Buffer 0.5+0.02 nautical mile around IL start point -> BL4

BL4 is a continuous line following coast line exclusively in the open water, 0.5 nautical mile from it.

1. Buffer 0.5+0.01 nautical mile around BL4 -> B5
2. Crop (Difference) IL by B5 -> IL2
3. Multipart to Singleparts IL2 -> IL3
4. Extract lines from IL3 with length over ML -> IL4
5. Convert Lines to Polygons IL4 -> IWP

IWP are inland water polygons with up to approximately 1 nautical mile inland water closure line. Accuracy of your result is dependent on accuracy of your input data, and accuracy of the buffers.

Example for mouth of Hawkesbury River, NSW, Australia using EPSG:3857, and 1852 metres (Nautical mile in SI) and filtering out all lines ML < 1852 metres

Hope this all make sense. Making screenshots, and detailed description of each step is in my opinion way over of GIS QA format. To conclude there is a lot of conditions to be met, and a lot of steps to be done. Some must be further broken into sub steps if you can't use programming and can use only QGIS Graphical Modeler (Model Designer) to automate steps. Personally I would not expect average GIS graduate to be able to sort this out on it's own in reasonable time frame.