Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

offline Openstreet map (OSM) integration #284

Open
rkarikari opened this issue Jul 2, 2024 · 15 comments
Open

offline Openstreet map (OSM) integration #284

rkarikari opened this issue Jul 2, 2024 · 15 comments

Comments

@rkarikari
Copy link

rkarikari commented Jul 2, 2024

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
Copy link
Author

rkarikari commented Jul 2, 2024

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
Copy link
Author

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
Copy link
Author

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
Copy link
Owner

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
Copy link
Author

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
Copy link
Owner

jvde-github commented Jul 3, 2024

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
Copy link
Author

rkarikari commented Jul 4, 2024

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
Copy link
Owner

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

@rkarikari
Copy link
Author

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
Copy link
Owner

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
Copy link
Owner

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
Copy link
Author

rkarikari commented Jul 5, 2024

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
Copy link
Owner

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
Copy link
Owner

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
Copy link
Author

Wonderful .... great news.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants