Leaflet Map with Cities in English in R - r

I am working on a Shiny application where I am required to plot positions of ships on a map. Currently I am using leaflet and the OpenSeaMap as the base layer on which I am plotting the positions (addProviderTiles(providers$OpenSeaMap)). However, when the map is rendered the various cities and ports appear in the local language as shown below:
That's not very useful as the users are mostly English speaking. Is there any way in changing the tiles to display only English names? I have already had a look at this. I am restricted to using the OpenSeaMap tiles only because of the traffic separation schemes displayed in those tiles.

If you have to stick to OpenSeaMap tiles then no, you can't change the language of the labels. Unfortunately these Labels are part of the raster images, they are not a separate layer.
However OpenSeaMap is composed of a base layer and a seamark layer (https://tiles.openseamap.org/seamark/). The base layer containing the map, city labels and so on is the OSM standard style and can be replaced by any other layer. So you can use a tile server with English labels plus the seamark layer on top of it.
If this is not a solution for you then how about adding an additional layer with English labels? So your users can at least switch to a layer with labels they can read, browse to the area they want to view, then switch back to OpenSeaMap tiles to see sea marks. Not a nice solution but it works.

Related

Plot both map and elevation profile views from .shp and .tif?

Say we have a route.shp from ESRI/ArcGIS origin representing the path or route of a hike or a stream, and a corresponding topographic raster file in a dem.tif with matching spatial coordinate system and projection info.
How can we quickly print both the map view and elevation profile in one static or ideally dynamic image? This is a classic view in navigation/outdoor/fitness apps (eg, Strava, or simplified below static image and more detailed below), of say a trip a user went on.
Ideal products would be both a ggplot2-like style w/ 1 column by 2 row plot.png (like below), and a plot.html with an interactive slider tool that scrolls simultaneously through map location and elevation (and ignore the red/green gradient in the profile). I'm looking more for convenience of plotly R than doing aShiny page, so more "off the shelf" than highly customizable, but I understand it seems a tall order to do concisely in open source environment?
library(rgdal)
library(raster)
library(tiff)
#other libraries?
route <- readOGR(".", "route")
topofile <- "dem.tif"

R - sf package - is it possible to create a zoomed-in map on top of a larger map with some additional features?

I would like to use the sf package to create a map of Europe and on top of it overlay a smaller, zoomed-in part of Europe. An example of how I would like my map to look like is pasted from Wikipedia here:
So, I know that I could first create a map of Europe, then separately a map of the zoomed-in region, and then probably use ggdraw to overlay them. However, specifically what I am interested in is how to create the red-shaded region which connects two rectangles (see image above). I was hoping that there is some method where this could be done automatically, but if you have any other workarounds, I would be very grateful.

How to obtain koppen-geiger climate map for ggmap

I would like to use ggmap to plot several data points on top of a koppen-geiger climate map.
The kopper-geiger data and GIS/KMZ maps can be downloaded here:
http://koeppen-geiger.vu-wien.ac.at/present.htm
I've managed to have a code to plot the points on regular maps, obtained through the get_map function but I fail to use other maps such as koppen-geiger.
Any help will be appreaciated!
Your basic problem is that the map you are attmepting to use is an image file that is not georeferenced. So unless you want to go through the unnecessary and probably time consuming process of georeferencing this image yourself, you will be better taking an alternative approach. There are perhaps a few ways to do this. But, unless you have very few data points to overlay on the map which you can place manually using the lat-long grid of the image, then the least painful method will certainly be to redraw the map yourself using the shapefile.
This is not the right place to give you an introductory lesson on GIS, but the basic steps are to
Download shapefile (which is available at the same website as the image you linked)
Project map to desired coordinate system
Plot map, coloring by climate class
Color the ocean layer
Add labels, legend, and graticule, as desired
Overplot with your own climate data, and legend for these.
If you are unsure how to approach any of these steps, then take an introductory course on GIS, and search the Web for instructional materials. You may find this resource useful.
https://cran.r-project.org/doc/contrib/intro-spatial-rl.pdf

How to create interactive online map with contour (filled) plot layer?

I would like to create an online interactive map with filled contour plot layer like the ones can be seen on openweathermaps (I would like to use my own data for the plots).
What I need is also similar to the Leaflet heatmap (heatmap.js) but without dynamically changing the colors and the extent of the graphical objects (as in case of heatmap.js). Let's call them static heat maps.
I would like to know which mapping code/library can be used to produce such maps.
I am really newbie to these things, so please bear with me.
I tried Leaflet but did not find any plugin which would create filled contour map layers (static heatmap). I created the following map with Leaflet where the rectangles are geojson polylines and the color is based on some assigned values to every rectangle (elevation)
my leaflet attempt
The problem with this approach is that if higher resolution (smaller and more rectangles) is needed the site would really slow down.
I checked OpenLayers but did not see any similar examples.
I have the data in a matrix format:
Lat; Long; Value
.
.
Values are given in every gridpoints.
(if needed I would convert into other formats, like in case of the above attempt into geojson format)
The data is static, would be saved on the server.
So what I basically want to accomplish is a site where some spatial data is represented as filled contour map (static heatmap) and it is plotted over a map.
Here is my solution to the problem using open-source programs and free, online service:
(1) Processing the data in a GIS program. I used QGIS. I interpolated my data which is in grid points to get a high resolution raster map.
(2) Save the post-processed raster map as a georeferenced *.tif image.
(3) Import the image into TileMill. Remove the basemap and keep only the image as the only layer (style it).
(4) Export the 'map' from TileMill as MBTiles. This will save numerous *.png files (tiles) corresponding to different zoom levels. These are the same type as google or openstreetmap use for their online maps.
(5) Create a free account at Mapbox and create a new map project. Upload the MBTiles created by TileMill (can be directly uploaded from it). Style it.
(6) Use the Map ID corresponding to your created project to embed the map into html sites, e.g. the javascript code:
// Provide your access token
L.mapbox.accessToken = 'Mapbox will generate this for you';
// Create a map in the div #map
var map = L.mapbox.map('map', 'username.mapid', {
minZoom: 5,
maxZoom: 10
}).setView([47, 20], 8);
Example hosted on Mapbox
Sample image(I do not how long will the above link live):
In retrospect, the question would have been better fit to GIS stack exchange.

Build my own off-line map server?

I am new to GIS and I am trying to deploy my own off-line map server.
I have found very interesting open source tools like: geoserver.
I have downloaded OpenStreetMap data from geofabrik.de
In the packages I downloaded from geofabrik we find different layers with diffrent information: landuse, natural, places, railways ... but not the base map i.e: the geographic map with country border and no other information.
My question is:
How can I get (download) this base map layer in order to use it off-line?
Thanks for any help.
I had exactly the same project recently. I tried several world maps (CloudMate, NaturalEarth) to put under geofabrik extractions. Most of them didn't have enough resolution to display properly on higher zoom levels.
Finally, I found ThinkGeo extractions. It contains a "complete world landmass polygons" layer, which is good enough for a background layer on any zoom levels. It turned out that ThinkGeo extractions for separate countries contain country borders and have higher quality than geofabrik. (I experienced missing objects with geofabrik.)
So I came up a solution displaying the landmass layer, and some of the countries depending on the focus of the project.
I'd recommend you to try ThinkGeo. They do weekly update on data.

Resources