0

I can make a R-Leaflet map in RStudio and export to html.

Here's the senario, a client has limited web infrastructure, basic webhosting: no database, no shiny server, no r-server etc.

They want an online map on their website which can be updated (by them), so how can I link the html so it looks up the coordinate from a file rather than being hard coded in the script (e.g. through src="lat-long.csv"). Alternatively could a shape file be accessed (using the SP library)? Or even a Geojson file.

Spatial Digger
  • 1,883
  • 1
  • 19
  • 37
  • You could write a script which would read data from the file and output an html file (leaflet). You would run this with e.g. php which should be a pretty common thing on servers these days. – Roman Luštrik Apr 02 '17 at 12:46
  • I'm not yet sure of their host server config, so I wanted to put something together that was very simple, something that works, obviously I'll explain that if they want to do any bigger geospatial projects they will have to invest in infrastructure etc. – Spatial Digger Apr 02 '17 at 20:09
  • I love R and Leaflet but there are probably some better tools out there to accomplish what your customers want. if you need to use leaflet your best bet is to probably to make the leaflet map using the leaflet javascript library and do everything client side. That would get you closest to src="lat-long.csv". If you want to use R I think you need to set up a shiny server. – Ian Wesley Apr 02 '17 at 22:56
  • @IanWesley don't you think if a script produced an html with leaflet components and copy it to an appropriate place, it wouldn't work? Sure, it's not very reactive, out of the box, frameworky like, but it would get the job done, especially for prototyping... – Roman Luštrik Apr 03 '17 at 07:14
  • Yeah, I agree that is an option, however it sounds like his customers IT environment is pretty restrictive. – Ian Wesley Apr 03 '17 at 13:19
  • Thanks, I'll just create something directly in leaflet.js outside of R I was being 'lazy'. – Spatial Digger Apr 05 '17 at 10:00
  • I use leaflet R all the time at work and we embed the results in webpages. Your output should be a series of HTML, JS and resource files (if you use images or documents in your maps). Once extruded you should be able to modify the Javascript to accommodate the sorts of things you are looking for in your page. Consider converting the csv data to JSON with a set schema and your clients could upload new JSON to the assets folder on your simple server anytime. As long as they follow the schema format, the lat lon are within your map area and they use the same file name, it will work. – sconfluentus Apr 06 '17 at 12:14

0 Answers0