Hello all
This is a newbie here, both in Anvil, but also in web apps.
Quickly, I am a Geologist by education, and have worked over 10 years in the oil/gas field in Norway. My last position (9 years) was Geoscience Data Manager, seismic. I left my work last summer to study full time from home (edX, Coursera), firstly Python coding and also ML and now web app. A friend recommended me to use Anvil. I also have a background in GIS and relational databases (SQL ‘general knowledge’).
Ok, I am working with a public datasets which can be pointsets (wells) or polygons (fields).
I am going to use Mapbox. I have worked with it a bit, and I really like it.
I got help from Shaun. So I understand better, but of course I have to to try myself to do stuff.
I have a token from Mapbox and I tried now to display my map with Anvil.
So I created a secret, named it ‘Mapbox_token’, and pasted my token in there.
Then in my map form (called MapBoxMap), I have the following:
<link href='https://api.tiles.mapbox.com/mapbox-gl-js/v0.52.0/mapbox-gl.css' rel='stylesheet' />
<div id='mapBoxMap' style="width: 100%; height: 1000px;"></div>
<script>
mapboxgl.accessToken = 'Mapbox_token';
var map = new mapboxgl.Map({
container: 'mapBoxMap',
style: 'mapbox://styles/annee/cjqsbbdsrafaz2tpakytjdxze',
center: [6.0, 70.0],
zoom: 3
});
function addMarker(lng, lat) {
var marker = new mapboxgl.Marker()
.setLngLat([lng, lat])
.addTo(map);
};
</script>
My map is now blank (no error message telling me something is wrongly set).
Have I called my token the proper way in the code above?
Thanks a lot in advance for help,
Cheers
Anne