firelab / windninja

A diagnostic wind model developed for use in wildland fire modeling.
https://weather.firelab.org/windninja/
Other
115 stars 43 forks source link

ARC tile servers #484

Open bnordgren opened 1 year ago

bnordgren commented 1 year ago

Investigation of #483 strongly indicated that we were hitting MapBox's limit of 200,000 tiles/month for the free level of service that they offer. Investigations into whether the USFS geospatial services unit (GTAC) could host a tile server led to the suggestion that we just leverage ESRI's tile server by creating an API token from our enterprise accounts.

What ESRI Offers

The vast majority of ESRI's hosted tile layers are vector based, returning a *.pbf file. This is not natively understood by Leaflet. To use Leaflet as is, we need a pre-rendered raster tile. The listed raster products are:

The non-imagery (satellite/airborne imagery) raster products have very little detail useful for dragging the selection rectangle over.

Apparent Options

  1. Use a client other than Leaflet;
  2. Get the vector plugin for Leaflet;
  3. Stick with MapBox; or
  4. Find another tile server.

Annex A: Create an AGOL account (USFS Employees)

Go to https://usfs.maps.arcgis.com/home/signin.html and log in with your eAuth account.

Annex B: Determining ESRI Hosted Layer Type

To determine whether a hosted layer is vector or raster, after you made yourself an API token, go to the hosted tile layers link above and:

bnordgren commented 1 year ago

Chatter around vector plugins suggests they're experimental and unsupported...

https://openmaptiles.org/docs/website/leaflet/

nwagenbrenner commented 1 year ago

This link suggests that Esri vector tiles should work with leaflet.

https://developers.arcgis.com/esri-leaflet/layers/add-a-vector-tile-layer/

bnordgren commented 1 year ago

Maybe this is the plugin we should be looking at:

https://github.com/Esri/esri-leaflet-vector

bnordgren commented 1 year ago

... which has these dependencies...

Dependencies

Do you know what version of leaflet is bundled with windninja?

nwagenbrenner commented 1 year ago

Looks like leaflet 1.3.4. We could probably update though?

https://github.com/firelab/windninja/tree/master/data/leaflet

bnordgren commented 1 year ago

Prolly should anyway. So just spitballing, it sounds like the path of least resistance is option 2. We update the bundled leaflet, bundle esri-leaflet-vector and its dependencies, and tweak the downloader code.

I'm not going to get to this prior to AL in early April, as I need to focus on getting the Openstack hardware physically cabled. As long as the stopgap solution in #483 works for you for now, I can come back to this when I get back...

nwagenbrenner commented 1 year ago

Sounds good to me. I released 3.8.1 with the solution in #483 yesterday, so we are good for a little bit. We can work on this when you're back. I'll probably try to release 3.9.0 with some other fixes/upgrades around the end of May/early June. Would be good to include this in that release.

fspataro commented 1 year ago

Slightly more advance option but might make it more seamless with the overall code base is to use the ArcGIS Qt SDK: https://developers.arcgis.com/qt/

This would give you a native form element rather than an embedded html/js page. If the functionality is simply 'display public maps from arcgis services and draw boundary polygons', you should be fine with the low level 'lite' (ie free) licensing level.

nwagenbrenner commented 1 year ago

@fspataro Thanks Fred! We'll check this out.

bnordgren commented 1 year ago

ArcGIS Maps SDK for Qt requires developers to adopt Qt 6, which allows the SDK to take advantage of new graphics APIs, platform architectures, language features, and more.

Perhaps using this SDK is a goal for when Windninja is pulled forward to a newer QT. OTOH, integrating this ESRI dependency may force future upgrades before you're ready. Unless you say otherwise, I'll start picking at option 2.

bnordgren commented 1 year ago

Successfully converted html to esri-leaflet in my branch https://github.com/bnordgren/windninja/tree/arc_tile_servers

Works great in Firefox on ubuntu host. Doesn't want to work in the QT4 widget inside the app. What's the status of QT5 on master? I got an unresolved symbol when trying to run.

nwagenbrenner commented 1 year ago

The Qt5 option in master is work that was done several years ago to attempt write a new GUI in Qt5. We didn't get very far and then decided for an even bigger overhaul to modernize the GUI with an in-app viewer in Qt5. Technosylva is helping us on this, but we haven't gotten very far. I haven't built with the Qt5 option in our master branch in a long time, some functions may have changed. I can't remember if it was using the C API or not. The easiest solution is to try and get something working in Qt4. I think our Qt5 GUI is still a ways out.