Happy #MapInfoMonday
Today's post is driven by a question from @Mette Kramer Langgaard from SEGES. She is creating buffers around agricultural fields in Denmark, some 600,000 of them. She is however only interested in the buffer lying outside of the field. She doesn't want to have the actual field included in the result.
She is looking for a buffer outside the existing polygon where the inside of the buffer has been erased.
When creating buffers using Buffer Table from the Buffer dropdown on the Spatial tab, you will get buffers that also include the input object.
When using this process, you will be asked to create a new table or use an existing table, specify the buffer settings, and how to handle the data aggregation.
From the Table tab, I click on the SQL dropdown and click on the SQL control to open the SQL Window. We will use the SQL Window to run the update statement.
From the New dropdown, I click on Update Statement to get the structure of an update statement.
If the function inserts the function, it will also include the list of parameters that the function expects. This can be very helpful as you don't have to write it yourself.
The expression above is similar to what you would get if you were using the Buffer Table method discussed above. So we need to modify this slightly.
We want to remove the existing polygon from this polygon. In MapInfo terminology, this is called erase. And so is the function that can help us do this: Erase()
.
The Erase()
function takes two parameters: the input object and the erase object. Our buffer will be the input object and the existing polygon will be the erase object.
The resulting statement will look like this:
Update Lake_Buffer
Set OBJ = Erase(CartesianBuffer(obj, 36, 100, "m"), obj)
------------------------------
Peter Horsbøll Møller
Principal Presales Consultant | Distinguished Engineer
Precisely | Trust in Data
------------------------------