Select to view content in your preferred language

buffer within polygon

4841
8
Jump to solution
01-07-2015 08:44 AM
AndrewBivins
New Contributor III

I am trying to create a buffer of water locations (point.shp) within a pasture (polygon.shp).  When i run a multiring buffer of the water locations the rings extend beyond the pasture fence lines.  I need to rings to stop at the fence lines. 

you can see from my map that the water locations need to stay within the pastures but as of now the rings go beyond the pasture lines.  I was able to clip the buffer by the outside of the polygon file so the rings don't extend beyond the outside perimeter.  I need it to do this within the internal fence lines.

Any idea on how I can do this.

Tags (2)
0 Kudos
1 Solution

Accepted Solutions
XanderBakker
Esri Esteemed Contributor

Is this more or less what you are trying to get?

BufferPasture.png

View solution in original post

0 Kudos
8 Replies
XanderBakker
Esri Esteemed Contributor

You will probably have to script this or créate a model:

  • Loop through each fence polygon
    • Select the water points inside the current polygon
    • Do the multiring buffer
    • Clip with the current fence polygon
0 Kudos
AndrewBivins
New Contributor III

Xander, that will work but I have about 110 different pastures that I need to run it for.  Any way to automate it so I don't have to do the model 110 different times?

Thanks

0 Kudos
XanderBakker
Esri Esteemed Contributor

If you have some sample data that follows the structure you want to use, I can see if I can come up with a script to process the 110 pastures.

0 Kudos
XanderBakker
Esri Esteemed Contributor

Is this more or less what you are trying to get?

BufferPasture.png

0 Kudos
AndrewBivins
New Contributor III

Yes,

That is exactly what I am trying to do. How did you manipulate my data. I only sent a pdf correct? Bigger question is how did you get the buffers to stay within the borders of the individual polygons?

0 Kudos
XanderBakker
Esri Esteemed Contributor

I converted the PDF to raster, changed the raster, did some vectorization and made some edits (added some additional water points).

The unpolished code I used I included below.

  • It creates a list of OID's of the fence areas
  • Loops through the list of OID´s
    • creates a featurelayer with only the current fence area based on OID
    • creates a featurelayer with only the water points in that area
    • creates the multi ring buffer on those points
    • clips the resulting buffers with the area

import arcpy, os

fc_pnt = r"C:\Forum\Pasture\test.gdb\waterpoints"
fc_pol = r"C:\Forum\Pasture\test.gdb\FenceAreas"

ws = r"C:\Forum\Pasture\test.gdb"
arcpy.env.overwriteOutput = True
dists="25000;50000;75000;100000;125000;150000;175000;200000"

fld_oid = arcpy.Describe(fc_pol).OIDFieldName
lst_OIDs = [r[0] for r in arcpy.da.SearchCursor(fc_pol, "OID@")]

for oid in lst_OIDs:
    where = "{0} = {1}".format(arcpy.AddFieldDelimiters(fc_pol, fld_oid),oid)

    arcpy.MakeFeatureLayer_management(fc_pol, "flpol", where_clause=where)
    arcpy.MakeFeatureLayer_management(fc_pnt, "flpnt")
    arcpy.SelectLayerByLocation_management("flpnt", 'intersect', "flpol")

    fc_buf = os.path.join(ws, "buf_{0}".format(oid))
    arcpy.MultipleRingBuffer_analysis(Input_Features="flpnt",Distances=dists,
                                      Output_Feature_class=fc_buf,Buffer_Unit="Default",
                                      Field_Name="distance",Dissolve_Option="ALL",
                                      Outside_Polygons_Only="FULL")

    fc_bufclip = os.path.join(ws, "buf_{0}clip".format(oid))
    arcpy.Clip_analysis(fc_buf,"flpol",fc_bufclip)

    # ... also merge the buffer layers into a single featureclass
AndrewBivins
New Contributor III

Xander,

I would like to send you a PM. 

Andrew

0 Kudos
NikHenryOz
New Contributor III

Hi Xander and Andrew,

Not sure if you could revisit this, as I really appreciate your work here on this issue.

I work with multiple farmer/producers who would love this function available in ArcGIS Online.

With another complexity though, can we restrict the buffer growth with line features rather than polygons?

Cheers

Nik

0 Kudos