jvde-github / AIS-catcher

AIS receiver for RTL SDR dongles, Airspy R2, Airspy Mini, Airspy HF+, HackRF, SDRplay and SoapySDR
https://aiscatcher.org
GNU General Public License v3.0
483 stars 76 forks source link

offline Openstreet map (OSM) integration #284

Open rkarikari opened 3 months ago

rkarikari commented 3 months ago

Hello,

I have ais-catcher and dump1090 (ADS-B) runnning on the same Pi3b+ unit.

The web viewer for dump1090 (tar1090) has an option to display offline maps if available. ++ red arrow ++ The offline map tiles are stored locally and tar1090 locates them and makes them available as a map option.

Screenshot 2024-07-02 at 9 01 03 AM

Is there a way to do same with ais-catcher, (especially since the tiles are already locally stored) ?

Screenshot 2024-07-02 at 9 10 40 AM

The installation script for tar1090/dump1090 has this ....

Screenshot 2024-07-02 at 9 23 15 AM

https://github.com/wiedehopf/adsb-wiki/wiki/offline-map-tiles-tar1090

Thanks

rkarikari commented 3 months ago

I tried creating a plugin with the following ..

// { "version": 2, "description": "offline openstreetmap", "author": "github" }

addTileLayer("Offline OpenStreetMap", new ol.layer.Tile({
 source: new ol.source.XYZ({
 url: 'http://127.0.0.1/tar1090/osm_tiles_offline/{z}/{x}/{y}.png',
attribution: '©',
subdomains: 'abcd',
maxZoom: 10,
minZoom: 0
 })
}));

I get the offline Map option ...

Screenshot 2024-07-02 at 11 41 07 AM

but a black screen when I select it.

Screenshot 2024-07-02 at 12 43 08 PM

any help would be appreciated. Thanks

rkarikari commented 3 months ago

Finally got it working!!!

Had to replace the loopback (127.0.0.1) with the externally reachable address (192.168.x.x) as I was testing from a remote computer.

// { "version": 2, "description": "offline openstreetmap", "author": "github" }

addTileLayer("Offline OpenStreetMap", new ol.layer.Tile({
 source: new ol.source.XYZ({
 url: 'http://192.168.8.142/tar1090/osm_tiles_offline/{z}/{x}/{y}.png',
attribution: '©',
subdomains: 'abcd',
maxZoom: 10,
minZoom: 0
 })
}));
Screenshot 2024-07-02 at 3 42 16 PM
rkarikari commented 3 months ago

My config setting are stored in a file.

is there a way to include ...

CDN /opt/ais/webassets PLUGIN /opt/ais/offlinemaps.pjs

in the config file ?

jvde-github commented 3 months ago

Glad that plug-in is resolved. You can find the CDN in the config json here: https://github.com/jvde-github/AIS-catcher#configuration-file

Assume plugin is the same but let me know if it does not work!

rkarikari commented 3 months ago

Thanks ...

Was trying another ...... "Maptiler VectorMaps"

// { "version": 2, "description": "offline Maptiler VectorMap", "author": "github" }

addTileLayer("Offline VectorMap", new ol.layer.Tile({
 source: new ol.source.XYZ({
 url: 'http://192.168.8.142:8080/data/v3/{z}/{x}/{y}.pbf',
attribution: '©',
subdomains: 'abcd',
maxZoom: 14,
minZoom: 0
 })
}));

I see that the files get pulled from the local tileserver ...

Screenshot 2024-07-02 at 10 11 49 PM

but don't get displayed in ais-catcher "usual black screen".

The tile format is .pbf and should appear like this ..

Screenshot 2024-07-02 at 10 17 26 PM

Is this (Maptiler vector maps) supported by ais-catcher ?

jvde-github commented 3 months ago

I haven’t tried it but I think so. AIS-catcher is using the openlayers library. Perhaps a internet search on those two terms provide some hints?

I haven’t experimented with it though. Let me know how it goes otherwise will try to experiment a bit with it in the next few days.

rkarikari commented 3 months ago

I've noticed the following ...

  1. Raster tiles ( png, jpg, webp ) work.
  2. Vector tiles (pbf) don't.

OpenLayers v9.2.4 does support vector layers,..... and I verified at their site ( replacing thier map with mine ) as shown below.

Openlayers Vector tiles support

Screenshot 2024-07-04 at 10 08 14 AM

Please take a look whenever you are able.

Thanks so much.

jvde-github commented 3 months ago

Happy to test. Perhaps it is an additional script that is needed. Where can I find PBF tiles to test?

rkarikari commented 3 months ago

Maptiler has these MBtiles for free download ... Maptiler Downloads

Or you can use their hosted ones ... https://api.maptiler.com/tiles/v3-lite/{z}/{x}/{y}.pbf?key=8EANolnPbeOlwTl6Qga9

I (or you ) can delete the "key" portion (from this post) when you are done.

jvde-github commented 2 months ago

This works:

// {"author":"YourName","version": 2, "description":"Add MapTiler hosted map"}

addTileLayer("MapTiler", new ol.layer.VectorTile({
    source: new ol.source.VectorTile({
        format: new ol.format.MVT(),
        url: 'https://api.maptiler.com/tiles/v3-lite/{z}/{x}/{y}.pbf?key=8EANolnPbeOlwTl6Qga9',
        attributions: '<a href="https://www.maptiler.com/copyright/" target="_blank">&copy; MapTiler</a> <a href="https://www.openstreetmap.org/copyright" target="_blank">&copy; OpenStreetMap contributors</a>',
        maxZoom: 19
    })
}));

But is visualized a bit particular, is this what you expected: Screenshot from 2024-07-05 23-15-18

jvde-github commented 2 months ago

Got it to run with the styling but need to figure out how to implement in the program properly: Screenshot from 2024-07-05 23-45-25

rkarikari commented 2 months ago

Maptilers site has this .....

Screenshot 2024-07-05 at 10 22 32 PM

and ais-catcher shows this...

planet

How did you get it running with styling.... was the change made in the plugin ?

Thanks thus far.

jvde-github commented 2 months ago

Changing things all over the place :-) and including a new script but have not figured out how to do in the production version. The styling is impacting also existing maps.

jvde-github commented 1 month ago

Managed to get it running without error messages; I realized I should use the right CDN (unpkg) otherwise it becomes a rabbit hole to sort the modules. Now, the problem is to get the tiles and the styling file for testing....

rkarikari commented 1 month ago

Wonderful .... great news.