Converting json to geojson - r

I'm quite new to R and I was trying to make an interactive map showing coronavirus cases.
I was planning to use leaflet for R to create the map and using this source (https://covid.ourworldindata.org/data/owid-covid-data.json) for the data.
However, leaflet requires the data to be in .geojson.
How do I convert the data to the .geojson format?

Related

How to create spatial data using shiny and leaflets

I want to create spatial data (shp data, gpkg data, geojson) using shiny and leaflet.
For example, in QGIS, I want to implement the function of Create Layer> newVectorLayer New> Shapefile Layer ... with shiny.
The geometry type I want to create is a polygon.
Therefore, I want to hit a pin on the map and create spatial data with the hit pin as the outer circumference.
Please let me know if you have a reference web page.

Exporting an existing leaflet map as KML/KMZ format in R

I have written a script in R to draw a dynamic map that users can interact with using the leaflet package. I need to submit this map as a KML/KMZ format for it to be acceptable according to the journal's requirements.
Is there an function in R that I can save the map as one of these format so that it can be compatible with google earth?

How to extract selected data from interactive htmlwidget plot

I am trying to figure out a way to extract data from a selection of an interactive plot in Shiny. I build a parallel coordinates plot using a package found at https://github.com/timelyportfolio/parcoords which builds a parcoords chart using htmlWidgets. It allows users to make specific slections, as seen below:
What I need is a way to extract the highlighted rows from the underlying data set, either through a download button or data table. Is there anyway to pull out this info from the underlying htmlWidget process? Any advice is appreciated.
Using crosstalk you can let one htmlwidget talk to another. The dev version of parcoords supports crosstalk integration as does datatable, so you can link the two with minimal effort

Custom background image with ggmap

I'm using R and ggmap to analyse some geographic data. I would like to use my own background map (a tif file) instead of the ones provided by ggmap (google maps, osm, stamen, etc.).
Is there a way to load my own raster file and display it using ggmap ? I really want to keep ggmap as most of my analysis use ggmap's functions (geom_density2d, geom_tile, etc.). For example a wrapper that transform a raster file reads by the raster package to a ggmap get_map object ?
Thanks

how to convert RgoogleMaps PNG to SpatialGridDataFrame in R?

I have derived a 'static map' using the GetMap() function from the RgoogleMaps package. I can save it (MyMap) to my harddrive as a PNG. However, then it looses the spatial reference.
Has anybody succeeded in creating a spatial object (in the sense of a GDAL-readable data format) from such a PNG?
Get your RGoogleMaps object as MyMap. Make it download the tile to MyTile1.png Use the raster package.
bb = MyMap$BBOX
t = stack("MyTile.png")
extent(t)=extent(bb$ll[,2],bb$ur[,2],bb$ll[,1],bb$ur[,1])
Now t is a raster stack. Do plotRGB(t) and you should see it. Now you can try writeRaster to create a GDAL data source. GeoTIFF perhaps?
And watch out for that pesky Google image usage agreement...

Resources