F Exercise 04
Last updated: 2020-08-12 00:41:49
F.1 Question 1
- Read the Shapefile named
nafot.shp
, which includes polygons of “Nafa” administrative regions in Israel. - Calculate how many neighboring polygons each “Nafa” intersects with (not including self!).
- Print a map that shows the number of neighbors per “Nafa” (Figure F.1).
- Remember: do not use specific values in your calculation, the number of neighbors needs to be calculated in the code!
(50 points)
F.2 Question 1
- Load the built-in
data.frame
object namedworld.cities
from themaps
package, as follows:
library(maps)
head(world.cities)
## name country.etc pop lat long capital
## 1 'Abasan al-Jadidah Palestine 5629 31.31 34.34 0
## 2 'Abasan al-Kabirah Palestine 18999 31.32 34.35 0
## 3 'Abdul Hakim Pakistan 47788 30.55 72.11 0
## 4 'Abdullah-as-Salam Kuwait 21817 29.36 47.98 0
## 5 'Abud Palestine 2456 32.03 35.07 0
## 6 'Abwein Palestine 3434 32.03 35.20 0
- The
world.cities
object is a table with world cities of population greater than about 40,000. The table includes the longitude and latitude of each city in thelong
andlat
columns, respectively. - Read the Shapefile named
nafot.shp
, which includes polygons of “Nafa” administrative regions in Israel. - Subset those cities which intersect with the “Nafa” polygons.
- Calculate, a layer named
pol
representing the area in each “Nafa” that is \(>20\) \(km\) from the nearest city inworld.cities
. - Note: Transform
world.cities
to the ITM Coordinate Reference System ofnafot.shp
(which is in ITM), then use ITM for all calculations. - Plot:
- The “Nafa” layer (transparent, with grey borders)
- The calculated layer with the area \(>20\) \(km\) from the nearest city (in green)
- All cities intersecting with the “Nafa” layer (as circles)
- Add text labels on the areas \(>20\) \(km\) from the nearest town with the name of the corresponding Nafa (in red).
- In the end, you should get a map such as the one shown in Figure F.2.
(50 points)