Developing Data Products - Coursera Week 2

Peer-graded Assignment: R Markdown and Leaflet

Here is a Shanghai sightseeing map that I have created for the coursera assignment. I am using the Leaflet package to add layers of map, tags and pop-up URLs. The webpage is created in R Markdown.

library(leaflet)
my_map <- leaflet() %>%
  addTiles()

After arriving at PVG international airport you can take the magnetic train to LongYang Station (super duper fast, a 30 km trip takes only 7 minutes). Transfer to subway Line 2 there and it gets you downtown in about 20 minutes.

Our trip begins from People’s Square, where you will start your exploration through the old city of Shanghai. People’s square is also the metro transit center and you can reach here via subway line 1, 2 and 8. So I would recommend to find a hotel in this area.

regions_to_know <- data.frame(name = c("People's Square - Adventure begins!", "Pudong Airport - Shanghai International Airport",  "Meglev Train - Long Yang Subway Line 2", "Ruoyu Parents"),
                              pop_radius = c(4000,2000,500,500),
                              lat = c(31.2329198,31.1507, 31.20886,31.08678),
                              lng = c(121.4713130,121.8018,121.56821, 121.22612))
shanghai_map <- my_map %>%
  addCircles(data = regions_to_know, lng = ~lng, lat = ~lat, 
             weight = 3, popup = ~name, radius = ~pop_radius) %>%
  addMarkers(data = regions_to_know, lat = ~lat, lng = ~lng, popup = ~name) %>%
  addPolylines(data = regions_to_know, lng = ~lng[2:3], lat = ~lat[2:3], label = c("Meglev Train"))
shanghai_map

Museums

Shanghai Museum

If you want to learn about the history of old China (from 100 up to 10,000 years ago), you can visit the Shanghai Museum (free entrance, open 7 days a week). There you will find beautiful stone and iron-casted sculptures, proceleins, paintings and artwork from antient time. The history from the last century…Mmmm…I am not sure if there is a museum providing such sensitive knowledge in Shanghai at the moment.

Shanghai Urban Planning Exhibition Center

However, if you are interested in the old city of Shanghai and its city planning, this might be a good option (I’ve never been there myself!).

museum_icon <- makeIcon(
  iconUrl = "https://cdn2.iconfinder.com/data/icons/industry-7/32/industry_government-512.png",
  iconWidth = 50,
  iconHeight = 30,
  iconAnchorX = 50,
  iconAnchorY = 30
)

museums_gps_lat <- c(31.23034, 31.2329198)
museums_gps_lng <- c(121.47089, 121.4713130)
museums_popup <- c("<a href = 'https://www.tripadvisor.nl/Attraction_Review-g308272-d311592-Reviews-Shanghai_Museum_Shanghai_Bowuguan-Shanghai.html'>Shanghai Museum </a>",
                   "<a href = 'https://www.tripadvisor.nl/Attraction_Review-g308272-d554654-Reviews-Shanghai_Urban_Planning_Exhibition_Hall-Shanghai.html'>Urban Planning Exhibition Center</a>")
my_map <- my_map %>% 
  addMarkers(lat = museums_gps_lat, 
             lng = museums_gps_lng,
             popup = museums_popup,
             icon = museum_icon)

Architecture Old vs. New

Shanghai is a new city, famous for its skyline by the Bund (like de Maas in Rotterdam). On the west side of the river there are still many old architecture, on the east side is the new finance district. I always find it a nice (visually contradicted) experience to walk along the river and look at the buildings on both sides. You can also take a ferry boat to cross the river like a local would do (Not as exciting as the water taxi in Rotterdam though!).

Jing An Temple

Jing An Temple is located near the city center, you can get there with Line 2 and Line 7. It is an old yet grand temple, marvelous to see. Together with Yu Garden, it is one of my favorite destinations that represented the old Shanghai. Only free to enter on certain days. We gotta need to check the calendar.

Yu Garden

Yu Garden used to be a private garden owned by a wealthy family and took generations to construct. However they left Shanghai during the war early 20th century and now it is open to the public. It can get crowded during the day though. If you are lucky to avoid the tourist groups, it’s a nice place to relax and appreciate the landscape design from the old time.

Oriental Pearl TV Tower

One of the first landmark of Shanghai, a 468 m high TV tower. There is a buffet restaurant on the tower which revolves 360 degree over an hour at 268 m. It’s not a bad choice to enjoy the view and the food at the same time. At the 259 m viewpoint there is a balcony made of transparent glass floor. It’s a challenge and I bet your adrenaline level goes high!

Shanghai Tower

Now as the tallest building in Shanghai, this 632 m giant (!!) offers you the opportunity to look over the city in the cloud. Never been there myself yet.

buildings_icon <- makeIcon(
  iconUrl = "https://cdn3.iconfinder.com/data/icons/buildings-places/512/Corporation-512.png",
  iconWidth = 30,
  iconHeight = 50,
  iconAnchorX = 30,
  iconAnchorY = 50
)

buildings_gps_lat <- c(31.2249156, 31.22916, 31.24196, 31.23561)
buildings_gps_lng <- c(121.4416143, 121.48803, 121.49527, 121.50138)
buildings_popup <- c("<a href = 'https://www.tripadvisor.nl/Attraction_Review-g308272-d311585-Reviews-Jing_an_Temple-Shanghai.html'>JingAn Temple</a>", "<a href = 'https://www.tripadvisor.nl/Attraction_Review-g308272-d324259-Reviews-Yu_Garden_Yuyuan-Shanghai.html'>Yu Garden</a>", "<a href = 'https://www.tripadvisor.nl/Restaurant_Review-g308272-d3449881-Reviews-The_Oriental_Pearl_TV_Tower_Of_Shanghai_Revolving_Restaurant-Shanghai.html'>Oriental Pearl TV Tower - 468 m</a>", "<a href = 'https://www.tripadvisor.nl/Attraction_Review-g308272-d9814601-Reviews-Shanghai_Tower-Shanghai.html'>Shanghai Tower - 632 m</a>")
my_map <- my_map %>% 
  addMarkers(lat = buildings_gps_lat, 
             lng = buildings_gps_lng,
             popup = buildings_popup,
             icon = buildings_icon)
my_map