geocompr | Open source book : Geocomputation with R | Dataset library
kandi X-RAY | geocompr Summary
kandi X-RAY | geocompr Summary
This repository hosts the code underlying Geocomputation with R, a book by Robin Lovelace, Jakub Nowosad, and Jannes Muenchow:. Lovelace, Robin, Jakub Nowosad and Jannes Muenchow (2019). Geocomputation with R. The R Series. CRC Press. The first version of the book has been published by CRC Press in the R Series and can be viewed online at bookdown.org. Read the latest version at geocompr.robinlovelace.net.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of geocompr
geocompr Key Features
geocompr Examples and Code Snippets
Community Discussions
Trending Discussions on geocompr
QUESTION
I would like to create the static map using R and Mapdeck. I am doing it for the first time, and I just want just any png map output at this stage. (Eventually I want to create USA map with 50 states and with extended horizontal bar charts for some cities.)
On the website below I found a sample code. At the moment I just want a simple png of this file. I created mapdeck token, I can run this code with no errors, but I do not get any "viewer" output that would display the map that I would export to png. I have found other mapdeck/R codes on the web, and none of them display any visuals.
...ANSWER
Answered 2019-Sep-03 at 21:54There are a couple of possible issues
- A known issue where you can't see the map in your RStudio viewer
The solution is to open it in a browser by pressing the 'open in new window' button
- There are
NA
s in the data, and it's focusing you on (0,0)
The solution to this is to either remove the NAs, or simply zoom out
Also, the package has been updated to v0.2.1 since that article was written, so there's a couple of subtle changes to the code.
QUESTION
Edit after input below and e.g. here: leaflet has to make a compromise between "understandable for non-gis-experts" and "correct gis-handling". What I understand now, leaflet focussed on easy handling, thus, projections cannot really be implemented.
Originial question: My goal is to display "real" densities correctly, that is in events/m^2. At the moment I am struggeling with leaflet's projection's. What do I have to do, to display all crsClasses correctly? My data generates uniform random points on the shere.
I guess I miss to transform the data?
...ANSWER
Answered 2019-Jun-14 at 13:41My goal is to display "real" densities correctly, that is in events/m2
You should use an equal-area projection, then.
but I don't understand why this corresponds to
worldCopyJump = FALSE.
The worldCopyJump
is an interaction option, and not a visualization option. Let me quote Leaflet's reference, emphasis mine:
With this option enabled, the map tracks when you pan to another "copy" of the world and seamlessly jumps to the original one so that all overlays like markers and vector layers are still visible.
In other words: That option only impacts the behaviour of the map when the user pans the map around so that the map's center crosses the antimeridian. It doesn't have any other effect. It doesn't make multiples copies of the data as Leaflet.RepeatedMarkers does, and it doesn't magically reposition your data so it looks nicer.
Using
crsClasses[2]
... looks strange
You're using a map with a EPSG:4326 coordinate system, but the background tiles are still in EPSG:3857. As explained elsewhere, Leaflet does not reproject raster data (unlike OpenLayers does in some very specific scenarios). If you change the map's CRS, you are in charge of changing the map's tile source(s) as well.
EPSG:4326 is the coordinate system for the equirectangular projection, based on the CRS84 geoid.
It has the property that the extents of the earth look like a rectangle of ratio 2:1; Leaflet makes the assumption that a tile server serving tiles in EPSG:4326 has two tiles for the zoom level zero. Compare that with the assumption Leaflet makes about EPSG:3857 having just one square tile at zoom level zero.
Do not change the CRS blindly and expect things to work. Choose a map projection, find its EPSG code, then find (or build) base maps for that projection.
QUESTION
I apologise in advance for the very basic nature of this question, but I'm confused about how the mask() function works in the raster package in R.
Reading the documentation for the function it sounds like cells in raster x are set to NA (the default) if these cells match a maskvalue in a mask object (the default maskvalue being NA). However, the description of the mask() function in the book Geocomputation with R by Lovelace et al. (https://geocompr.robinlovelace.net/spatial-operations.html#spatial-ras) (section 4.3.1) makes it sound as if cells in raster x are KEPT if they match a maskvalue in a mask object, and set to NA if they don't. They give this example:
...ANSWER
Answered 2018-Jun-15 at 21:30What stops you from making a small example and test which approach works? In your case, neither [1] nor [2] will work, as maskvalue is a single value (the first value if you provide a longer vector). You probably want to use reclassify first
Example data
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install geocompr
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page