question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Not fully rendering Map and markers

See original GitHub issue

Have the problem with map: not fully rendering Map.

My application work using vuejs-templates and vue-loader. And I found some problem with webpack and Vue2Leaflet, after that I add to my main.js next lines:

import L from 'leaflet';
delete L.Icon.Default.prototype._getIconUrl;

L.Icon.Default.mergeOptions({
  iconRetinaUrl: require('leaflet/dist/images/marker-icon-2x.png'),
  iconUrl: require('leaflet/dist/images/marker-icon.png'),
  shadowUrl: require('leaflet/dist/images/marker-shadow.png')
});

And after that, I have the same issue.

My component:

<template>
  <div>
    <l-map style="height: 90%" :zoom="zoom" :center="center">
      <l-tile-layer :url="url" :attribution="attribution"></l-tile-layer>
      <l-marker :lat-lng="marker"></l-marker>
    </l-map>
  </div>
</template>

<script>
import { LMap, LTileLayer, LMarker } from 'vue2-leaflet';
export default {
  name: 'example',
  components: {
    LMap,
    LTileLayer,
    LMarker
  },
  data () {
    return {
      zoom:13,
      center: L.latLng(47.413220, -1.219482),
      url:'http://{s}.tile.osm.org/{z}/{x}/{y}.png',
      attribution:'&copy; <a href="http://osm.org/copyright">OpenStreetMap</a> contributors',
      marker: L.latLng(47.413220, -1.219482),
    }
  },
  methods: {
    mounted() {
        setTimeout(function() { window.dispatchEvent(new Event('resize')) }, 250);
    }
  }
}
</script>

Result rendering map:

screen shot 2018-04-15 at 3 01 01 pm

Question:

How it fix? @KoRiGaN do you have any ideas?

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:1
  • Comments:25 (3 by maintainers)

github_iconTop GitHub Comments

43reactions
nwpuhmzcommented, Apr 25, 2018

@ximet I added import "leaflet/dist/leaflet.css"; to my main.js ,then solved it.

35reactions
KoRiGaNcommented, Apr 15, 2018

Hi @ximet,

You need to import the css from leaflet into your project.

import "leaflet/dist/leaflet.css"

Hope this helps,

Mickaël

Read more comments on GitHub >

github_iconTop Results From Across the Web

Marker component not rendering markers when using .map ...
I am trying to render markers for some various longitudes and latitudes on my map and for some reason, when the app loads,...
Read more >
LWC Map markers not rendering - Salesforce Stack Exchange
I am creating a component that displays the current users accounts on a map. The map markers are not displaying. Am I overlooking...
Read more >
Map markers not rendering [#1990048] | Drupal.org
I installed Drupal 6.28 and Gmap 6.x-2.0-beta2 last night. First problem was my map not rendering at all, so I searched existing issues, ......
Read more >
Adding a Map and Markers to a React Application
This tutorial shows you how to add a Map and Marker to a React ... Note: The above snippets will render a blank...
Read more >
google-map-react - npm
Additionally, it can render map components in the browser even if the Google Maps API is not loaded. It uses an internal, tweakable...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found