i'm using leaflet js Choropleth map :
https://leafletjs.com/examples/choropleth/
what i'm trying to do on click at (california ) area load form databeas all loaction (lat,long) that in same area ??
Since the Choropleth Map is a GeoJson with a collection of polygons, I would go about and use this library https://github.com/hayeswise/Leaflet.PointInPolygon to determine if a given location is in the given polygon or not.
Related
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.
Does anyone have some sample code I can look at that creates an interactive map in R/Shiny? I would like to be able to have the map zoom in to a specific US State based on the user selection in a drop down
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
I rendered a map using leaflet library in R, so can we make it interactive using R (which identifies a location on click on the map like google maps)
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.