[R-sig-Geo] How to objectively subset cities by population
Thiago V. dos Santos
thi_veloso at yahoo.com.br
Thu Jul 27 16:11:33 CEST 2017
Hi Kent,
Thank you very much for the response.
This is exactly the same approach I am using now, with a different radius formula though.
It is not at all terrible, but do you see how overlapped the largest cities are, and how difficult it is to click on some smaller cities?
This is why I am looking for an objective way to filter out the smallest cities, while at the same time keeping as much information on the map as possible (i.e. not leaving too many "blank" areas).
Best, -- Thiago V. dos Santos
PhD studentLand and Atmospheric ScienceUniversity of Minnesota
On Thursday, July 27, 2017, 7:29:44 AM CDT, Kent Johnson <kent3737 at gmail.com> wrote:
Date: Thu, 27 Jul 2017 04:09:53 +0000 (UTC)
From: "Thiago V. dos Santos" <thi_veloso at yahoo.com.br>
To: R-sig-geo Mailing List <r-sig-geo at r-project.org>
Subject: [R-sig-Geo] How to objectively subset cities by population
Message-ID: <1634627903.292923. 1501128593268 at mail.yahoo.com>
Content-Type: text/plain; charset="UTF-8"
Dear all,
I have temperature records of nearly 1200 locations in southern Brazil.
I am writing a shiny app that will show an interactive map with the locations plotted as circles, where the user can click a location to see its temperature time series.
However, if I show all the locations in the map, it will look really bad, too cramped.
Have you considered using leaflet to make an interactive map? This is a good start:
library(leaflet)locs <- read.csv("https://www.dropbox.com/s/ykdd8x1mlc76klt/locations.csv?raw=1")
leaflet(locs) %>% addTiles() %>% addCircles(radius=~20*sqrt(Population), label=~as.character(Geocode), stroke=FALSE, fillOpacity=0.5)
You can configure popups to show HTML or get Shiny events on click, for example clicking on a city could display the time series in a separate panel.
Docs and many examples on the leaflet for R web site:
https://rstudio.github.io/leaflet/
Kent
[[alternative HTML version deleted]]
More information about the R-sig-Geo
mailing list