bcgov / CCISS_ShinyApp

CCISS RMD knitr report graphics and Shiny App
Apache License 2.0
14 stars 3 forks source link

does bc gov have a mapbox API key? #21

Closed cmahony closed 1 year ago

cmahony commented 3 years ago

@whmacken question from @meztez : does bc gov have a mapbox API key? i've sent out inquiries but haven't heard back yet.

meztez commented 3 years ago

Once you have set up your account, here are the styles this app is using. You can reuse them on a bcgov owned account.

You can copy the mapbox styles using these links https://api.mapbox.com/styles/v1/meztez/ckm9qzg1u2grj17n1qo25bt1r.html?fresh=true&title=copy&access_token=pk.eyJ1IjoibWV6dGV6IiwiYSI6ImNrbTlqcGRsbzFpcjUycHJ0aXhnNWVjczMifQ.b-5f6EiF8dtdzATV1xyOnQ https://api.mapbox.com/styles/v1/meztez/ckm9qe3ts2g5w17qswd6qodjj.html?fresh=true&title=copy&access_token=pk.eyJ1IjoibWV6dGV6IiwiYSI6ImNrbTlqcGRsbzFpcjUycHJ0aXhnNWVjczMifQ.b-5f6EiF8dtdzATV1xyOnQ

Or use the attached json

Outdoors-Hillshade(ckm9qzg1u2grj17n1qo25bt1r).zip Streets-labels(ckm9qe3ts2g5w17qswd6qodjj).zip

dewikiswani commented 2 years ago

if I use the environment according to github, I can't run it, an error will appear, so I change the postgre setting to localhost and three environments for MAPBOX as directed above, so that a shiny pop up appears but still can't display the map and simulate the process of features in the program.

Here I attach the process of the changes I made. this is the console view on Rstudio: BCGOV_USR="postgres" BCGOV_PWD="1234" BCGOV_DB="climate" BCGOV_HOST="localhost" BCGOV_TILESERVER="https://tileserver.meztez.com/data/tiles/#{z}/{x}/{y}.pbf" BCGOV_TILELAYER="BECMap" BCGOV_MAPBOX_TOKEN="pk.eyJ1IjoibWV6dGV6IiwiYSI6ImNrbTlqcGRsbzFpcjUycHJ0aXhnNWVjczMifQ.b-5f6EiF8dtdzATV1xyOnQ" BCGOV_MAPBOX_LABELS_STYLE="https://api.mapbox.com/styles/v1/meztez/ckm9qzg1u2grj17n1qo25bt1r.html?fresh=true&title=copy&access_token=pk.eyJ1IjoibWV6dGV6IiwiYSI6ImNrbTlqcGRsbzFpcjUycHJ0aXhnNWVjczMifQ.b-5f6EiF8dtdzATV1xyOnQ" BCGOV_MAPBOX_HILLSHADE_STYLE="https://api.mapbox.com/styles/v1/meztez/ckm9qzg1u2grj17n1qo25bt1r.html?fresh=true&title=copy&access_token=pk.eyJ1IjoibWV6dGV6IiwiYSI6ImNrbTlqcGRsbzFpcjUycHJ0aXhnNWVjczMifQ.b-5f6EiF8dtdzATV1xyOnQ"

the error display that appears: image

the results of the program display (Error: object "mbhsstyle" not found): image

Please help me so I can run this program so that the map view can appear and can simulate the shiny features provided. Thank you

meztez commented 2 years ago

I believe this app database backend is currently under development. @kdaust ?. There is a demo there with a mock server if you want to see the app features, you should not use its data as they are being worked on. https://neoxone.shinyapps.io/BCGOV_CCISS/.

As to the error you are seeing, I think maybe the environment variables were set within RStudio, since the Rmarkdown process is not able to use them to set mbhsstyle. Maybe use an .Renviron file within the app folder.

dewikiswani commented 2 years ago

so the reason I can't display maps is because the database is being built right?

I have saved the .Renviron file in the app folder, and it has also been read in the running program, image

but the object that cannot be found in the program is this output$bec_map (at map.R file) which contains MBHSSTYLE and MBLBSTYLE objects (which are BCGOV_MAPBOX_LABELS_STYLE and BCGOV_MAPBOX_HILLSHADE_STYRON objects in the .Renviron file) image

even though if I open the link in the browser given above it will display maps like this image

and image

kdaust commented 2 years ago

Hi! This repo has actually been replaced by a new version: https://github.com/FLNRO-Smithers-Research/CCISS_ShinyApp_v12, and that version (still in development) is live at https://thebeczone.ca/shiny/ccissdev/

Feel free to check out that repo! But you won't be able to run it locally without the .Renviron file with the database and tileserver passwords