Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [ggmap]

ggmap is an R package best known for spatial visualization with Google Maps and OpenStreetMap

2
votes
2answers
178 views

Plotting spatial points data in R?

I have some kind of noob question: how do I plot spatialpoints dataframe in R using spplot (or ggmap) based on column values? let's say we have this: library(sp) data(meuse) v <- ...
0
votes
1answer
61 views

Legend color scale problem with tmap for island

Bornholm_data <- geo_RH %>% filter(KOMNAVN=="Bornholm") tm_shape(geo_RH) + tm_fill(col="Befolkning") + tm_borders() mainland <- tm_shape(mainland_data, projection = 0) + ...
-1
votes
1answer
47 views

Dealing with Islands with sf objects and the tmap package [closed]

I have the bounderies for the municipalities in the "capital region" of Denmark. The acctual map looks like this: The yellow island is the fourth row in my sf object. I am trying to folllow the ...
0
votes
1answer
57 views

How to I limit the x and y axes with tmap in r

I have made this plot with the following code: library(tmap) tm_shape(RH2) + tm_fill(col="AREAL") + tm_borders() But there is a dot on the far right (an island) which I don't ...
13
votes
2answers
179 views

How to create a map of Denmark with ggmap

I have installed the following two packages: library(ggmap) library(maps) I have found code online to create a world map (see below). How do I zoom the plot on a country level? For example, Denmark. ...
0
votes
1answer
147 views

Setting fill to a variable based on data within SpatialPolygonsDataFrame?

I'm currently on the cusp of getting done what I want to get done - but having a slight problem with referring to my data from within R's sp SpatialPolygonDataFrame object. The issue is how ggplot2 ...
1
vote
1answer
47 views

Using R to create a choropleth generated from lat/lon lists - with data generated internally

a friend referred me here as opposed to the regular Stack Overflow site, as this community maybe better able to help! My issue is largely with the syntax and framework of ggmap,ggplot, and the sp ...
0
votes
0answers
214 views

Google Maps Lat/Lon Data from ggmap::geocode; Displays Web Mercator but returns decimal degrees in EPSG 4326?

I understand Google Maps is projected to Web Mercator to calculate distances in meters, EPSG 3857. Does the Google Maps geocoding API also return EPSG 3857 lat/lon data? Or does it return EPSG 4326 ...
0
votes
1answer
151 views

change ggmap to sp.: Create circle where radius represents distance (km)

I am trying to made multiple concentric circles of multiple radii in kms scaled to a map, similar this post was using the post here (ggmap: create circles). map.sp<-readShapeSpatial("C:file.shp") ...
1
vote
1answer
450 views

Converting projected coordinates from bbox into long/lat using R?

I have a DEM file in QGIS and would like to import the the satellite image for the same region into R. According to QGIS, the CRS used in the DEM file is: Layer Spatial Reference System +proj=...
0
votes
1answer
64 views

Plotting shapefile into Google Maps and then plot some of the points

I am currently doing spatial analysis project where I have a shapefile (in Delhi region). That shapefile also consists of ward level data. Sample data set is given below: A B C Ward_No 1 2 ...
3
votes
0answers
36 views

smearing in Linux, but not in Windows

I must have a Linux library out of wack since the following image has "smears" on the colors. Is there a better term? On my Windows 7 RStudio it works fine. this image is from a Ubuntu 16.04 LTS ...
-1
votes
1answer
407 views

get_googlemaps returning map with warped longitude/latitude in R?

I'm trying to retrieve a tile of Downtown Los Angeles from Google Maps using ggmap and ggplot2, specifically the function get_googlemaps, and then I want to overlay a shapefile over it displaying the ...
1
vote
0answers
284 views

Changing border opacity in R ggmap()

I have the following code which produces the map below. As you can see, the map correctly overlays two sets of polygons: A large polygon outlining the city of Liverpool A group of polygons outlining ...
2
votes
2answers
463 views

R get_map returns map correctly, but filename argument does not work?

In R library ggmap there is a function get_map which saves a file (or at least have saved files automatically two or three years ago). Now get_map is not saving anymore, although the parameter ...
0
votes
1answer
2k views

simple plotting of (latitude, longitude) points on a global map

I have a dataframe like the following: country <- c('US', 'CA','TW') city <- c('Atlanta','Halifax','Taipei') lat <- c(33.8004, 44.6500, 25.0392 ) lon <- c( -84.3865,-63.6000,121.5250 ) ...
5
votes
1answer
363 views

Verify if a lat-long fall in my route

I am using ggmap package to generate routes. The resulting data frame will contain the routes information from the given source to the destination. library(ggmap) route_df <- route(from = "...
1
vote
0answers
190 views

Overlaying shapefile on ggmap [closed]

I have a dataset of village boundaries in ESRI format. with the following projection information, GEOGCS["GCS_WGS_1984",DATUM["D_WGS_1984",SPHEROID["WGS_1984",6378137.0,298.257223563]], PRIMEM["...
1
vote
1answer
1k views

Plotting polygon on Google map?

I have a dataset with points in NYC. I extract the bounding box (max and min lat/lon) and plot it on a map. It works for the basemap stamen watercolor, but not for google's. Why? Here is the code to ...
2
votes
2answers
3k views

How to overlay point co-ordinates on tmap shapefile?

So far, I've managed to visually present data for different socio-economic factors at a district level in Pakistan with the help of the tmap package in RStudio to create the following output. At the ...
9
votes
2answers
9k views

ggmap: plot polygon from shapefile

Using ggmap, I want to include municipality borders (polygon) from a shapefile on a map containing some location points. This script does everything except plotting the polygon: library(rgdal) ...
1
vote
0answers
162 views

make a matrix from rasterLayer / plotting custom coloured raster in ggmap

I'm trying to add a raster layer to a ggmap object. The basic data is a .tif and as I get strange errors by loading it by the package tiff or rtiff, I decided to make first a rasterLayer (it works) ...
1
vote
0answers
163 views

ggmap with Gauss Krueger coordinates

I am using R for doing a map of groundwater levels which means I have some measurements at some coordinates in the Gauss-Krueger system and I interpolated between these measurements. I want to plot ...
3
votes
1answer
80 views

Chaotic geo image in R

I am working with qmap (R package ggmap) and when I enter the following code: qmap("Rotterdam", maptype = "terrain", zoom = 13) + geom_polygon(aes(x = long, y = lat, group = group, fill = ...
1
vote
0answers
78 views

Shapefile misforming when overlaid on map

I thought I was attempting something pretty simple - adding a shapefile over a terrain map. This is how the image looks when the shapefile is added to Google Earth: However, when I process the data ...
1
vote
2answers
2k views

Remove lines from inside a polygon (shapefile) in r

I have this code which prints the Galápagos Islands. But inside the islands, there are lines that I want to get rid off. How is this possible in R? library(rgdal) library(ggplot2) URL <- "https:/...
1
vote
2answers
308 views

Transformation from EPSG:31983 to EPSG:4326 change only one axis (R + ggmap)

I'm trying to convert my shapefile with spTransform(), but it's not successful. I don't know why it's changing only one axis. I want to change the axis into decimal degrees. # Libraries --------------...
3
votes
0answers
63 views

Determine if mapped points are related geographically [closed]

Hoping you can help. I'm a clinician trying to determine if some mapped points are related. I basically have a data set of certain long/latitudes. Each lat/long is associated with a positive Sputum ...
1
vote
1answer
266 views

Tearing of SpatialLinesDataFrame and problem with gClip function

I am trying to use ggmap with geom_map and geom_path commands to add a SpatialPolygonsDataFrame of African countries and a SpatialLinesDataFrame over a raster. When I use the defined function gClip() ...
2
votes
1answer
6k views

Creating spatial population heat map

I have some data that contains crab males population based on latitude and longitude. I am trying to plot the population distribution on map (not point density). For example I like to show which areas ...
3
votes
1answer
526 views

Tearing of polygons using ggmap and readOGR

I'm trying to incorporate a shapefile of US states with ggmap and keep getting "tearing" of my polygons. I tried changing group=id to group=group which helped, but didn't seem to resolve the boundary....
1
vote
0answers
536 views

Seeking replacement for ggmap::geocode? [duplicate]

I've found ggmap's geocode() function really useful over the years as it's got a 'fuzzy' search implemented by Google. However, I'm wondering if there are alternatives, because geocode() seems ...
1
vote
0answers
65 views

Batch Geocoding in R over daily limit with pay as you go? [duplicate]

I have found the the geocode function in ggmap to be very helpful in the past. Now I am trying to geocode about 60,000 addresses. The google maps API daily limit is 2500. Google offers a "pay as you ...
2
votes
0answers
277 views

About shp for ggmap in the R

I am a new in R and GIS, so I kindly ask you on advice. I had a shp which I want to plot on google map. The shpfile is here: http://www.filedropper.com/exercisestanddata First I do this: ogrInfo(...
1
vote
1answer
120 views

The shape does not fit the ggmap

I try to fit my shape to the google map. require(rgdal) in.dir <- getwd() sh <- readOGR(in.dir, layer = "Ytor", p4s = "+proj=tmerc +lat_0=0 +lon_0=15.80827777777778 +k=1 +x_0=1500000 +...
6
votes
1answer
3k views

ggmap: clip a map

I'm using ggmap to grab Washington DC and I have a shapefile that I downloaded from here: library(ggplot2) library(ggmap) library(maptools) dc = get_map(location = 'DC', zoom = 12) nhbds = ...
1
vote
1answer
577 views

Convert shapefile to WGS84 [duplicate]

I have a shapefile with shapelength and shapearea, and would like to convert to WGS84 to use with ggmap. Eventually, I would like to get plot google map of individual regions of the shapefile, and ...
5
votes
3answers
3k views

Save and load maps for ggmap to use without internet access

I would like to use the ggmap package to download and display maps. Unfortunately I have some firewall restrictions preventing R from accessing the internet directly. The error I get from get_map is ...
2
votes
0answers
57 views

Creating Concentric circles using the ggmap function from GGMAP package R [duplicate]

I would like to create two concentric circles using the ggmap package and ggmap function, one being 1/4 mile and the other 1 mile radius around the 16 metro rail stations in Los Angeles California. It ...
6
votes
1answer
1k views

Plotting data without geographical coordinates besides the main map in ggplot2

I am trying to plot some data as a bubble chart on the world map using ggplot2 package in R. I am able to proceed as follows. # Load necessay packages library(ggplot2) library(rworldmap) library(...
5
votes
1answer
2k views

Geographic Heatmaps with Concentric Circles by Distance?

I'm looking to generate a geographic heatmap (using 'ggmap') that overlays some dimension (to start, housing prices) over the lat/lon near a city center. Then I want to create circles of equi-distant ...
0
votes
1answer
708 views

R using fortify to project shapefile on google map gives wrong results

I have a shapefile that looks like this > str(FieldsMap) Formal class 'SpatialPolygonsDataFrame' [package "sp"] with 5 slots ..@ data :'data.frame': 3 obs. of 2 variables: .. ..$ id : ...
1
vote
0answers
88 views

How to solve coordinate differences between packages

I have two maps generated by two different methods. The first, I used maps package and the function map() and symbols(). On the other hand, I used the ggmap package with the ggmap() and geom_point() ...
6
votes
0answers
2k views

How to prevent cross-world lines in ggplot world map?

I'm having issues displaying 'great circles' paths and polygons in ggmap, an extension of ggplot2. Please enter the following code to replicate my issues: https://gist.github.com/Robinlovelace/...
7
votes
1answer
8k views

ggmap: create circle symbol where radius represents distance (miles or km)

I am trying to add a circle around a given latitude and longitude point where the circle size (radius) reflects distance in miles or km. I managed to come up with this example using ggmap, where I ...
1
vote
1answer
985 views

Adding a grid and selecting random cells from spatial polygon in r

I have a fairly similar question to this: Similar Question I am working with a map of Denmark or more a subset of a Denmark Map. This file comes from the Global administrative areas site GADM site ...
0
votes
1answer
583 views

ggmap fortify start and end jumble

I have a census tiger line file for counties available from the Census website. I am trying to display this file on a ggmap, but fortify seems to jumble the regions. I can't find anyone else who has ...
0
votes
2answers
1k views

projection conversion from mercator to google maps format

Is this spTransform(Finland3, CRS("+proj=longlat +ellps=WGS84 +no_defs+ellps=WGS84 +towgs84=0,0,0 ")) the right way to project a shapefile with this projection coord. ref. : +proj=merc +lon_0=0 +...
6
votes
1answer
2k views

Loading a png image as a map with ggplot2/ggmap

I am trying to find a workaround for ggmap's missing support of world maps (i.e. you can't create any maps that show latitudes > 80°, due to idiosyncrasies in the mapproj package). To a limited extend ...
0
votes
1answer
3k views

r openproj to plot in open street map in a different projection

I am very new to geographic data, so I am sorry for the stupidity of the question. I need to plot some data that are in this projection EUREF_FIN_TM35FIN Projection: Transverse_Mercator ...