0

I have a polygon feature data set of emergency service zones for Tucson Metropolitan Area and want to copy the polygon attributes to the patches. The code is only creating/coloring these patches.(Picture shown below).
enter image description here

I want to create a patch that covers the entire emergency service zone (second picture shown below) enter image description here

Here is my code. I tried using the vertex of the polygon and was not successful. I tried using the center of the polygon and I came out with a different output than what I want.

My code is:

to setup-gis ;; copy gis features to patches
  clear-patches 
  show "Loading patches..." 
  gis:apply-coverage ESZs-dataset "STATION_NO" emergency-zone
  foreach gis:feature-list-of ESZs-dataset [ feature ->  
    ask patches [
    let centroid1 gis:location-of gis:centroid-of feature 
    ask patch item 0 centroid1 item 1 centroid1  [
      set emergency-zone gis:property-value feature "STATION_NO"
      set pcolor yellow
      ;show emergency-zone
        ]
   ]
   ]
  show "Done"
end
JenB
  • 17,620
  • 2
  • 17
  • 45
  • to setup-gis ;; copy gis features to patches clear-patches show "Loading patches..." gis:apply-coverage ESZs-dataset "STATION_NO" emergency-zone foreach gis:feature-list-of ESZs-dataset [ feature -> ask patches [ let centroid1 gis:location-of gis:centroid-of feature ask patch item 0 centroid1 item 1 centroid1 [ set emergency-zone gis:property-value feature "STATION_NO" set pcolor yellow ;show emergency-zone ] ] ] show "Done" end – Kamel Alami Jul 19 '20 at 00:34
  • for some reason I can't post the code in a correct format. Sorry for the inconvenience – Kamel Alami Jul 19 '20 at 00:35

1 Answers1

0
foreach gis:feature-list-of ESZs-dataset [ ;for each polygon
 polygon ->
 ask patches gis:intersecting polygon [
  set emergency-zone (gis:property-value polygon "STATION_NO")
  set pcolor yellow     ]
]

If I understood well, you want to give attribute values to all the patches that intersecting corresponding polygon.. So you should ask patches that are intersecting with ask patches gis:intersecting

Naturaleza
  • 99
  • 8