1

I'm looking for a way to create a polygon (grey area in picture) behind another polygon (green), just like a shadow from a point / another polygon (blue).

To make it clearer here's what I mean:

enter image description here

It seems obvious to create a 100 m buffer around the green polygon, but what would be the next step? If it's only one polygon, I'd cut it manually, but it's +100.

I'm using ArcMap Basic licence without any extensions. And no coding skills.

  • 1
    Using just Basic, you've got a serious chunk of Python coding in your near future. Not difficult, but tedious beyond measure. You need to calculate bearing from the point to all points in the polygon, determine field of view, generate a conical shape past the target, generate the buffer, clip the buffer with the source, clip the buffer with the cone, then remove the part which is in front of the shape. Coding questions here are expected to contain code, so please Edit the question to contain what you have. – Vince Jul 24 '19 at 11:07
  • 2
    OP is not asking for a coding answer, it should not be closed for lack of code attempt – BERA Jul 24 '19 at 15:02
  • @Vince I think your comment would make a perfectly valid answer. As you explained, their goal isn't possible given the tools and skills at their disposal. Maybe expand on it by mentioning which expansions/licences would be necessary to achieve this without coding. – csk Jul 24 '19 at 15:25
  • The free GIS software QGIS has a plugin (also free) for calculating viewsheds: gis.stackexchange.com/q/215569/81764 – csk Jul 24 '19 at 15:26
1

Yes it is much more straightforward with advanced license using near, erase, points to line etc. tools. Anyway the workflow below will work with basic license and it is a good candidate for model builder. Shouldn't be hard to shuffle through 100 polygons. It honors selection:

# find script to convert all building vertces to points
arcpy.FeatureVerticesToPoints_management(in_features="BUILDING", out_feature_class="C:/SCRATCH/ALL_POINTS.shp", point_location="ALL")
arcpy.AddGeometryAttributes_management(Input_Features="VIEW_POINT", Geometry_Properties="POINT_X_Y_Z_M", Length_Unit="", Area_Unit="", Coordinate_System="")
arcpy.SpatialJoin_analysis(target_features="ALL_POINTS", join_features="VIEW_POINT", out_feature_class="C:/SCRATCH/SJ.shp", join_operation="JOIN_ONE_TO_ONE", join_type="KEEP_ALL", field_mapping='GISBUILDIN "GISBUILDIN" true true false 10 Long 0 10 ,First,#,ALL_POINTS,GISBUILDIN,-1,-1;ORIG_FID "ORIG_FID" true true false 10 Long 0 10 ,First,#,ALL_POINTS,ORIG_FID,-1,-1;GISBUILDIN_1 "GISBUILDIN_1" true true false 10 Long 0 10 ,First,#,VIEW_POINT,GISBUILDIN,-1,-1;POINT_X "POINT_X" true true false 19 Double 0 0 ,First,#,VIEW_POINT,POINT_X,-1,-1;POINT_Y "POINT_Y" true true false 19 Double 0 0 ,First,#,VIEW_POINT,POINT_Y,-1,-1', match_option="CLOSEST", search_radius="", distance_field_name="Distance")
# add fields to store view points coordinates
arcpy.AddField_management(in_table="SJ", field_name="NEW_X", field_type="DOUBLE", field_precision="", field_scale="", field_length="", field_alias="", field_is_nullable="NULLABLE", field_is_required="NON_REQUIRED", field_domain="")
arcpy.AddField_management(in_table="SJ", field_name="NEW_Y", field_type="DOUBLE", field_precision="", field_scale="", field_length="", field_alias="", field_is_nullable="NULLABLE", field_is_required="NON_REQUIRED", field_domain="")
arcpy.CalculateField_management(in_table="SJ", field="NEW_X", expression="[POINT_X]", expression_type="VB", code_block="")
arcpy.CalculateField_management(in_table="SJ", field="NEW_Y", expression="[POINT_Y]", expression_type="VB", code_block="")
# find end points coordinates and extend future line to 1000 m from view point
arcpy.AddGeometryAttributes_management(Input_Features="SJ", Geometry_Properties="POINT_X_Y_Z_M", Length_Unit="", Area_Unit="", Coordinate_System="")
arcpy.CalculateField_management(in_table="SJ", field="POINT_X", expression="[NEW_X]+( [POINT_X]- [NEW_X])/ [Distance]*1000", expression_type="VB", code_block="")
arcpy.CalculateField_management(in_table="SJ", field="POINT_Y", expression="[NEW_Y]+( [POINT_Y]- [NEW_Y])/ [Distance]*1000", expression_type="VB", code_block="")
arcpy.XYToLine_management(in_table="SJ", out_featureclass="C:/SCRATCH/RAYS.shp", startx_field="NEW_X", starty_field="NEW_Y", endx_field="POINT_X", endy_field="POINT_Y", line_type="GEODESIC", id_field="", spatial_reference="PROJCS['NZGD_2000_New_Zealand_Transverse_Mercator',GEOGCS['GCS_NZGD_2000',DATUM['D_NZGD_2000',SPHEROID['GRS_1980',6378137.0,298.257222101]],PRIMEM['Greenwich',0.0],UNIT['Degree',0.0174532925199433]],PROJECTION['Transverse_Mercator'],PARAMETER['False_Easting',1600000.0],PARAMETER['False_Northing',10000000.0],PARAMETER['Central_Meridian',173.0],PARAMETER['Scale_Factor',0.9996],PARAMETER['Latitude_Of_Origin',0.0],UNIT['Meter',1.0]];-4020900 1900 450445547.391054;-100000 10000;-100000 10000;0.001;0.001;0.001;IsHighPrecision")
# buffer (with dissolve) 1000 m rays and create their convex hull to produce sector
arcpy.Buffer_analysis(in_features="RAYS", out_feature_class="C:/SCRATCH/BUFFER.shp", buffer_distance_or_field="1 Meters", line_side="FULL", line_end_type="ROUND", dissolve_option="ALL", dissolve_field="", method="PLANAR")
# line below is the only "arcpy" expression
arcpy.CalculateField_management(in_table="BUFFER", field="Shape", expression="!Shape!.convexHull()", expression_type="PYTHON_9.3", code_block="")
arcpy.Buffer_analysis(in_features="BUFFER", out_feature_class="C:/SCRATCH/SECTOR.shp", buffer_distance_or_field="-1 Meters", line_side="FULL", line_end_type="ROUND", dissolve_option="NONE", dissolve_field="", method="PLANAR")
# intersect bulding buffer with sector and find shadow
arcpy.Intersect_analysis(in_features="BUFF_50M #;SECTOR #", out_feature_class="C:/SCRATCH/ISECT.shp", join_attributes="ALL", cluster_tolerance="-1 Unknown", output_type="INPUT")
arcpy.Union_analysis(in_features="ISECT #;BUILDING #", out_feature_class="C:/SCRATCH/SCRATCH.gdb/ISECT_Union", join_attributes="ALL", cluster_tolerance="", gaps="GAPS")
arcpy.SelectLayerByLocation_management(in_layer="ISECT_Union", overlap_type="ARE_IDENTICAL_TO", select_features="BUILDING", search_distance="", selection_type="NEW_SELECTION", invert_spatial_relationship="INVERT")
arcpy.MultipartToSinglepart_management(in_features="ISECT_Union", out_feature_class="C:/SCRATCH/SCRATCH.gdb/SPARTS")
arcpy.Sort_management(in_dataset="SPARTS", out_dataset="C:/SCRATCH/SORTED.shp", sort_field="Shape_Area DESCENDING", spatial_sort_method="UR")
arcpy.SelectLayerByAttribute_management(in_layer_or_view="SORTED", selection_type="NEW_SELECTION", where_clause='"FID" >0')
arcpy.DeleteFeatures_management(in_features="SORTED")

enter image description here

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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