1. home
  2. #tags
  3. HTML

Discover Latest #HTML News, Articles and Videos with Contenting

Breaking News Coronavirus Update: Vaccine Ready for Human Trials A vaccine for the novel coronavirus has been developed and is ready for human trials, according to the World Health Organization. The vaccine is a combination of two existing vaccines that have been modified to target the virus that causes COVID-19. Clinical trials will begin in the coming weeks and the vaccine could be ready for use by the end of the year. Read more here Article: How to Stay Positive During Coronavirus Outbreak The coronavirus pandemic has upended our lives and left us feeling anxious, uncertain, and overwhelmed. But despite the difficult times, it is important to stay positive. Here are some tips for doing just that: Focus on what you

Secure your website wherever you are (Sponsored by SSLs.com)

Show your company is legit, from $36.88ad

Buy a domain and everything else you need (Sponsored By namecheap.com)

adad

Eclipse map | R-bloggers

2017 Solar Eclipse with Totality - Composite – CC-BY-NC by Jeff Geerling I saw this post showing a map of the year of the most recent total eclipse, and people mentioning that we can find the data on the Five Millennium Canon of Solar Eclipses Database (the data also mentioned in the thread on ArcGIS don’t go before the seventeenth century). There is a bit of involved scraping because manually we can’t get more than 4 eclipses in a go and part of the generation is driven by javascript, but we can eventually get the whole 2538 eclipses between -1999 and 2024! Setup library(tidyverse) library(rvest) library(glue) library(httr) library(sf) library(mapview) Data First we make the query on the site: all total eclipse. It populates a select HTML control where we can manually scrape the eclipses dates with the browser tools. I saved them in a CSV file in the data directory. We will next chose an area of interest (AOI). I’ll open a spatial data of Metropolitan France (built by merging all regions) ; pick your own, in EPSG:4326… Note You can use data from Natural Earth with {rnaturalearth} for example. Add a character field eclipse_date to hold the dates of eclipse. eclipses_dates pull(astro_dates) aoi filter(insee_reg > "06") |> st_union() |> tibble(geom = _) |> st_sf() |> mutate(eclipse_date = NA_character_, .before = 1) Download files Based on a half-hidden URL, we will, slowly, ask for the KMZ to be generated, find its URL, get the file and save it in the results directory. It should take an hour… get_kmz html_elements("fieldset a") |> html_attr("href") |> GET(write_disk(glue("results/eclipse_{eclipse_date}.kmz"))) }, error = function(e) { message(" x Can't download/save") print(e) return(NULL) }) } eclipses_dates |> walk(slowly(get_kmz), .progress = TRUE) If you are eager to start, get a bundle of all of them from here (110 MB). Uncompress in results. Prepare the processing We need to open the right layer in each KMZ, as there are many of them with varying names, then we intersect it with our AOI, recursively. So we make one function for each task… Warning Many layers have geometry errors for the S2 engine: we will skip them ; so beware the map may be inaccurate! get_polygon keep(\(x) str_detect(x, "Umbral Path")) read_sf(glue("results/eclipse_{eclipse_date}.kmz"), layer = layer) |> st_zm() |> st_make_valid() |> st_collection_extract("POLYGON") |> transmute(eclipse_date = eclipse_date) }, error = function(e) { message(" x Error in opening") print(e) return(NULL) }) } crop_map select(eclipse_date), st_intersection(current_map, p) |> mutate(eclipse_date = eclipse_date.1) |> select(-eclipse_date.1)) } else { current_map } }, error = function(e) { message(" x Error in intersection") print(e) return(current_map) }) } And we run them: aoi_eclipse reduce(crop_map, .init = aoi) |> write_sf("aoi_eclipse.gpkg") You can use the Geopackage in QGIS, or just display it here: eclipse_year st_make_valid() |> group_by(year = str_sub(eclipse_date, 1, 5)) |> summarise() mapview(eclipse_year) Figure 1: Total Eclipses in France