How to manipulate json map data most elegantly
This article is about how to most elegantly manipulate json map data, the editor thinks it is very practical, so I share it with you. I hope you can get something after reading this article.
Know that recently in the leaflet community browsing the case, found that God has provided a very good json data parsing solution, at least two (conservative estimate) more than the package can win this task, and directly call off-the-shelf functions, do not need to write their own program.
The solution mentioned above is to make use of the mature json interface (Icano) tool:
Geojsonio package and rgdal package:
The two packages can be seamlessly converted between mainstream spatial format data.
Let's take the world map as an example to demonstrate the process of data conversion.
Library ("jsonlite")
Library ("ggplot2")
Library (plyr)
Library (dplyr)
Library (geojsonio)
Library (rgdal)
If you are still stuck in the era of manually extracting data using jsonlite packages, you may need to go through the following indescribable code steps:
Setwd ("D:/R/mapdata/State")
# # #
World_data