Select to view content in your preferred language

Polygon Buffering

12621
20
Jump to solution
03-27-2015 02:36 AM
AmazingMapMan
Occasional Contributor

Hello,

i have a polygon-featureclass that represents all communitys of germany.

Now I want to add a buffer to all "border" communities.

The buffer should only extend to the "outside" of germany so that the area of all "border" communities is extended with "foreign" territory.

I made a freehand-drawing to better illustrate my intention.

See attatchment.

What would be the best way to achieve this?

I have an ArcGIS Standard License.

Or can you imagine an sql-based approach (mssql) to the problem?

Any help is appreciated!

greetings

Stefan

0 Kudos
20 Replies
RichardFairhurst
MVP Honored Contributor

So any interest in the tool I demonstrated?  The tool itself ran in under 1 minute and total preparation time spent to create my demo than was less than 15 minutes.  Given that you are seeing results on data and a use case that I had never tested before and did not have in mind when I designed the tool, I think it did an excellent job.  In fact, the results are so good, I expect to resume testing of this tool on an entirely new set of data focused on the border/coastline buffer issue to see what refinements can be made specifically to handle that use case.

0 Kudos
RichardFairhurst
MVP Honored Contributor

Since you can see the python code I used with the coastline problem, which is yours to adapt or apply as you see fit, I assume your question about the cost or open source availability of my tool is related to the line buffer tool.  I have never sold my tools, but I have not yet published the add-in or source code for the line buffer tool at this point, because I have so far only focused on getting the core functionality to work.  As a result, the line buffer tool currently only works when I set up the inputs to match my test data layer names.  So, while I can set it up and use it with many different data inputs, it is still much too unfriendly for the average end user to use.

From the discussions on the line side buffer tool you can see there are several issues involved in using the base ArcObjects methods, and the problems grow as the side buffer distance and the geometry complexity increases.  I had to do extensive troubleshooting over several days just to develop subroutines that would let the methods accept my input geometry without the potential to trigger a catastrophic crash of ArcMap.  The Bug that crashes ArcMap affects the Edit->Copy Parallel option for Left handed offsets and occurs with a some line inputs that contain curves made up of highly densified line segments of 1/2 foot or less.  Esri recommends using the Smooth Line tool in the Generalization toolset of the Cartography toolbox prior to using that Edit option as a workaround.

So far all of my tests have been done using roadway networks as inputs, which is my primary use case.  The tool works best with relatively simple geometry, such as with a grid roadway network.  It even works very well with roadways that have broad flowing curves and some pretty complex intersections.  My tests also have been limited to very small buffer distance of only 30 feet.  The ArcObjects method may create other issues I have not yet encountered when I significantly increase the buffer distance.

How large of a buffer distance are you thinking of using?  Even if the method does not introduce a whole new set of problems when I increase the buffer distance that I have yet to encounter, the tool result does not really attempt to resolve issues that arise when the input line length is shorter than the buffer distance.  The tool expects the line lengths to always (or at least predominantly) be longer than the buffer distance, and when input lines are shorter than the buffer distance it leaves overlaps in the buffer geometry.

The tool also becomes less predictable when the input lines include a lot of small zigzags, wiggles, bends and sharp angle changes, like those found where jurisdictional boundaries follow natural features like the bank of a river or a ridge line.  That kind of input should not crash my tool, but probably they would create issues that my tool would include in its error log.  Without doing further tests I am not completely sure what results my tool would produce with a line input like the German border broken where the subarea boundaries meet using a very large buffer distance as an input.  But I think it would be worthwhile to test it so I could find out what practical uses the tool actually supports and better inform users of any known limitations.

I performed an experiment on my City boundaries.  To prepare the polygon data for use with my tool I did the following geoprocessing first:

1.  I ran the Polygon to Line tool with the option to identify and store the neighboring polygon information.  I ran this for all Cities, but for Germany you would first select just the German subareas to exclude all surrounding countries prior to running the tool.

2.  I selected the set of output lines where the LEFT_FID equaled -1 (no adjoining City).  If you excluded all surrounding country polygons this should represent the set of lines at the outer German boundary.

3.  Then I ran the Dissolve tool with the LEFT_FID and RIGHT_FID fields checked as my Dissolve Fields, and used the Unsplit Lines option.  This step is necessary, because the polygon perimeter may close at a location that does not meet an adjoining polygon boundary and I want only want line breaks where a change in the City occurs (or the subarea in your case).

4.  I created an polygon feature class that included the fields from my Cities and added a Long field named ORIG_OID and a text field with a length of 5 called LINE_SIDE.

I then ran my tool with a 300 foot buffer.

After the tool completed I set a definition query on the polygon layer to only show the LINE_SIDE values that were 'Left'.

Overall I consider the results to be very good, but there were issues that would need some manual attention.  In fact the tool actually helps to expose some topologically incorrect geometry in my source data.  The pictures below show the results and some issues that can be expected and possible fixes:

CityOuterBuffer1.png

CityOuterBuffer2.png

CityOuterBuffer3.png

CityOuterBuffer4.png

CityOuterBuffer5.png

CityOuterBuffer6.png

CityOuterBuffer7.png

CityOuterBuffer8.png

CityOuterBuffer9.png

CityOuterBuffer10.png

AmazingMapMan
Occasional Contributor

Hello Richard,

thanks for your insights. The results look quite good.

I need buffer areas with 1 and 2 kilometers, so its a little bit more than in your tests.

But i think that should erase some of the difficulties, since small inlets will be mostly omitted?!?

It would be great if I could use your tool.

But if you want I can provide you with my data so that you can test it for yourself.

0 Kudos
RichardFairhurst
MVP Honored Contributor

Hello Amazing MapMan:

I would prefer for you to provide me with the data, rather than send the tool to you in its current state.  I have realized that the sample data I have tested so far has not dealt with a wide array of spatial reference projections or measurement unit types.  I also am interested to see how it behaves with the wider buffer distance.  Being able to work with the results produced by your data directly will let me catch any unexpected behaviors much more quickly and will assist me with any debugging and retesting I may need to do

So in many ways your data would help me make sure my code will work internationally and find out how to best design it to meet needs like yours.  Also, it would be much better than any international data I would otherwise come up with for testing.  See my profile to contact me directly offline so that we can make further arrangements for sharing your data.

0 Kudos
AmazingMapMan
Occasional Contributor

Hello Richard,

thanks for this offer.

I could not figure out how to send you a private mail or something. This website confuses me way to often to be really useful ;-).

Anyway: in the attatchment you find a gdb with the german communitys that I am working with.

If you need something more, let me know.

I'm not in the office for some days (starting tomorrow) , so my reaction time can be a little longer now...

Thanks!

0 Kudos
LisaTurner
Frequent Contributor

Here's a link on how to send a message in here. Messages

Good luck on your project,

Lisa

0 Kudos
RichardFairhurst
MVP Honored Contributor

I have looked at the data and found out that the line offset method I built my tool around does not work with geographic spatial reference data (features that use angular coordinates like decimal degrees) and only works correctly with projected spatial reference data (features that use linear coordinates like meters or kilometers).  So there would be substantial distortion relative to the buffer the buffer tool made if I applied my tool.

The Copy Parallel option on the Editor drop down menu uses the same method that my tool uses.  You can see for yourself the results I would be getting by using that tool.  You have to input approximately 0.01 as the distance offset to use a decimal degree length that is approximately 1 km in length with that tool.  So while I might get the tool to produce a result, it would not really be correct for this spatial reference.

I will need a few days to check out whether other options exist to deal with large area data like this and how much the tool would have to be adjusted to work correctly with this data.  I will have to see if I can identify an alternative offset creation method that will work with the rest of the techniques I am using.  I also will have to convert the way I determine bearings to use geographic coordinates, which have to be handled differently from linear coordinates.

In any case, I have extracted the boundary lines that touch the international border and produced the remainder of the buffer left over after the German communities have been erased.  A manual process could create the output you want using these two feature classes in addition to those you already created.

0 Kudos
RichardFairhurst
MVP Honored Contributor

I created the exterior buffers for the communities.  My tool would not work with the projection, but I found methods to create it.  It was partly automated using Linear Referencing techniques, but there was a fair amount of manual tweaking, especially in the inlet pockets.  Anyway, here you go.

Now that I have done the geoprocessing steps and editing manually I have some ideas of how to automate this process, but I need to get my line network tool done first before starting a new tool.

0 Kudos
AmazingMapMan
Occasional Contributor

Hello Richard,

sorry for the late answer.

I'm back in the office now.

Regarding the Projection: Couldn't you just reproject the data to UTM or something befor using your tool?That would eliminate the need to adjust your tool to geographic coordinates?!?

I just had a look at the buffers that you created and they look absolutely amazing!

Even for "complicated" communities like "Nesselwang" or "Reichenau" the geometries look very good!

How much "manual tweaking" did you have to do?

Did you use tools from ArcGIS Advanced or is "Standard" sufficient?

0 Kudos
RichardFairhurst
MVP Honored Contributor

I agree that the user can use the Project tool to convert from a Geographic Coordinate System to a Projected Coordinate System before using my tool.  However, I am not familiar with the best projection choice for Germany, so I was not prepared to do that with this particular data.  Anyway, using a Projected Coordinate System would be a requirement of the line network buffer tool I am building at this stage and that requirement will be specified in the help and error messages for the tool by the time I release it.

Thanks for the feedback on the buffers.  I spent about 6 hours tweaking the results.  Essentially anywhere the cut between two communities bends, I drew that.   Bending cuts are not precisely measured to split between communities exactly 50/50 and is only eye ball accurate in those cases.  But since these cuts are within waters (rivers and coastal areas) obviously controlled by Germany and not another country, I was not too concerned about getting better precision.

For straight line cuts, the methods involved used a mixture of tools, some of which would require an Advanced license.  I had to use the Polygon to Line tool to extract the full community buffer outline and each communities outline as a line.  I had to delete all community boundaries that touched another community (easy to do if topology is perfect).  The Feature Vertices to Points tool was used to extract points from the ends of each community line for LR processing.  I also used the Features to Polygon tool to combine a set of lines at a normal angle to the buffer outline with the buffer to cut it into separate polygons.   The Feature Vertices to Points tool was used to extract points from the mid point of each community line and the Spatial Join tool (Basic license) was used to transfer attributes from the mid points to the cut up polygon output of the Features to Polygon tool.

The cut lines that were at a normal angle to the buffer outline were created with LR tools and techniques, which work with a Basic license.  With these tools I had to categorize the country outlines into groups that would build continuous non-branching, non-looping portions of the country outline into routes and then used the Create Route tool to build simple routes.  I used the Locate Features Along Route tool to create an event table of the community outside end points on the routes.  I used the Make Route Event layer to create offset points at 2 km from the Germany outline.  I used the Points to Line tool to create a line segment between the point on the line and the LR offset point.

The straight cut lines were all examined and where the normal angle to the line was not the best fit to the buffer I moved the offset end to a location that I liked manually.  I would estimate I did this for about 15-20% of the cut lines.  Moving the ends took longer than using the tools to get the 80% of correct cut lines, but was necessary.

Anyway, I hope your client is happy with the result.

0 Kudos