Hackout2/epimap

语言: R

git: https://github.com/Hackout2/epimap

地图团队的回购
Repo for the map team
README.md (中文)

Build Status

epimap

描述

一组函数,可以基于Leaflet快速轻松地创建交互式地图。设计用于通过sp对象处理mapData。还实现了一些函数来将更复杂的对象(如等高线,图形......)转换为sp对象。

安装

要安装软件包,您可以使用devtools。您还需要安装rleafmap。

devtools::install_github("fkeck/rleafmap")
devtools::install_github("Hackout2/epimap")

演示

首先,加载包和霍乱数据集。

library(epimap)
data(cholera)

该软件包提供了一系列简单的* Map函数,可轻松获取交互式地图。

quickMap

您可以使用quickMap快速表示点和多边形,并使用链接到sp对象的数据框的列设置颜色和大小。

quickMap(cholera$deaths, col.by="Count", size.by="Count")

quickmap

热图

您可以使用heatMap函数从SpatialGridDataFrame获取热图(栅格图像和/或轮廓线)。

heatMap(cholera$deaths.den)

heatmap

NETMAP

您可以使用netMap从igraph对象映射空间网络。例如,我们可以通过连接地理位置靠近的泵在Snow的伦敦建立一个泵网络。请注意,您需要使用lat和lon属性将地理坐标明确设置为图形顶点。

library(igraph)
library(sp)

pump.adj <- as.matrix(dist(coordinates(cholera$pumps)))
pump.graph <- graph.adjacency(pump.adj < 0.003, diag = FALSE)
V(pump.graph)$lat <- coordinates(cholera$pumps)[, 2]
V(pump.graph)$lon <- coordinates(cholera$pumps)[, 1]

netMap(pump.graph, v.size=5, width=500, height=300)

netmap

本文使用googletrans自动翻译,仅供参考, 原文来自github.com

en_README.md

Build Status

epimap

Description

A set of functions to quickly and easily create interactive maps based on Leaflet. Designed to work with mapData via sp objects. Also implements some functions to convert more complex objects (like contourlines, graphs, ...) into sp object.

Install

To install the package you can use devtools. You also need to install rleafmap.

devtools::install_github("fkeck/rleafmap")
devtools::install_github("Hackout2/epimap")

Demo

First, load the package and the cholera dataset.

library(epimap)
data(cholera)

The package provides a collection of simple *Map functions to easily get interactive maps.

quickMap

You can use quickMap to quickly represent points and polygons and set colors and sizes using a column of the dataframe linked to the sp object.

quickMap(cholera$deaths, col.by="Count", size.by="Count")

quickmap

heatMap

You can use the heatMap function to get an heat map (raster image and/or contour lines) from a SpatialGridDataFrame.

heatMap(cholera$deaths.den)

heatmap

netMap

You can use netMap to map spatial networks from an igraph object. For example we can create a network of pumps in Snow's London by connecting pumps which are geographically close. Note that you need to set explicitly geographical coordinates to the graph vertices with the lat and lon attributes.

library(igraph)
library(sp)

pump.adj <- as.matrix(dist(coordinates(cholera$pumps)))
pump.graph <- graph.adjacency(pump.adj < 0.003, diag = FALSE)
V(pump.graph)$lat <- coordinates(cholera$pumps)[, 2]
V(pump.graph)$lon <- coordinates(cholera$pumps)[, 1]

netMap(pump.graph, v.size=5, width=500, height=300)

netmap