vue-marker not displaying on map and map not fully rendering
See original GitHub issueDescription
Steps to Reproduce
- installed Vue2Leaflet via npm
- created a component called
Simple
with the following contents (just copied the Simple.vue example and added the style import)
<template>
<div class="simple">
<div id="top_div" style="height: 100%">
<v-map :zoom="zoom" :center="center" style="height: 1000px; width: 1000px">
<v-tilelayer :url="url" :attribution="attribution"></v-tilelayer>
<v-marker :lat-lng="marker"></v-marker>
</v-map>
</div>
</div>
</template>
<script>
import Vue2Leaflet from 'vue2-leaflet';
export default {
name: 'simple',
components: {
'v-map': Vue2Leaflet.Map,
'v-tilelayer' :Vue2Leaflet.TileLayer,
'v-marker': Vue2Leaflet.Marker
},
data () {
return {
zoom: 13,
center: [47.413220, -1.219482],
url: 'http://{s}.tile.osm.org/{z}/{x}/{y}.png',
attribution: '© <a href="http://osm.org/copyright">OpenStreetMap</a> contributors',
marker: L.latLng(47.413220, -1.219482),
}
}
}
</script>
<style>
@import "~leaflet/dist/leaflet.css";
</style>
Expected Results
I expect to see the basic map with marker from the example jsfiddle.
Actual Results
The map appears as a large gray box with a small section with rendered map tiles. My problem looks identical to the one described in #81 , but I do include the leaflet css import.
What is strange is that when I resize the window, the map loads as it should, but the marker does not show up. I see in the html that the marker is loaded, however:
Browsers Affected
- [x ] Chrome
- [x ] Firefox
- Edge
- Safari 9
- Safari 8
- IE 11
Versions
- Leaflet: v1.2.0
- Vue: v2.5.2
- Vue2Leaflet: v0.0.55
Issue Analytics
- State:
- Created 6 years ago
- Reactions:24
- Comments:47 (6 by maintainers)
Top Results From Across the Web
Vue Leaflet not rendering map - Stack Overflow
I want to render map with markers. I'm the beginner with Vue and maybe you can help me with that. I've followed some...
Read more >Vue2Leaflet: vue-marker not displaying on map and map not ...
When using Vue2Leaflet the map shows a graw box and only a small section of the map is rendered.
Read more >leaflet js map not showing fully on page load - Laracasts
First try setting width: 100% to #map . Then make sure when the JavaScript is loaded, the container around the map is loaded...
Read more >Marker | Maps JavaScript API - Google Developers
Renders the Marker on the specified map or panorama. If map is set to null , the marker will be removed. Parameters:
Read more >FAQ | Vue Leaflet
My map and/or markers don't fully render. ... If Leaflet does not provide a method to change an option on an existing element...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I’ve had some similar issues. The marker image issue I solved using info from these threads: https://github.com/PaulLeCam/react-leaflet/issues/255 https://github.com/Leaflet/Leaflet/issues/4849 https://github.com/Leaflet/Leaflet/issues/4968
Basically, sounds like webpack is jacking up the embedded image URLs in the CSS. Throwing this at the top of your
main.js
may help:I’ve gotten to the point that everything renders after the user resizes but I can’t figure out why I’m getting grey space before that…
I ended up with a hack that helped get everything to render correctly as far as the resize issue goes.
This works down to 200 ms. After that the hack fails. Seems to be some sort of race condition. I tested slower bandwidths and they work fine.