samedi 2 mars 2019

Folium Custom Tiles Requirements

I am using Python with flask for building a map of Mars and 'Curiosity' rover's movement on it.

I found these great maps (click), but some of them do not allow to zoom-in enough. I was also advised to use JMARS for creating such maps with high-res quality. After I did so, I got an PNG file which I used in my code as a tile attribute for folium.Map(..), but it doesn't seem to work (only blank background with my coordinates on it).

I would like to know whether it is even possible to create my own map-picture and use it for placing latitude/longitude data on it?

Or maybe it is possible to use some kind of custom image instead of TILE variable (as link) in my code?

You can check out my project and code here on GitHub as well as a part of it down below.

Any help or suggestions will be appreciated!

def build_map(data):

ATTR ='<a href="https://github.com/openplanetary/opm/wiki/OPM-Basemaps" target="blank">OpenPlanetaryMap</a>'
TILE = 'https://cartocdn-gusc.global.ssl.fastly.net/opmbuilder/api/v1/map/named/opm-mars-basemap-v0-1/all/{z}/{x}/{y}.png'

m = folium.Map(attr=f'NASA/MOLA |{ATTR}',
               location=(-4.58946695213448, 137.441633498919),
               min_zoom=1,
               max_zoom=20,
               tiles=TILE,
               zoom_start=12,
               prefer_canvas=False)

locations = [tuple(map(float, pair)) for pair in data]
folium.PolyLine(locations).add_to(m)




Aucun commentaire:

Enregistrer un commentaire