Search code examples
jvectormap

Custom Map ,there is no latLng ,how to add marker?


$(function(){ var map, markerIndex = 0, markersCoords = {};

      map = new jvm.WorldMap({
          map: 'jilin',
          markerStyle: {
            initial: {
              fill: 'red'
            }
          },
          container: $('#world-map-gdp')
      });

      map.container.click(function(e){
          var latLng = map.pointToLatLng(e.offsetX, e.offsetY);
        alert(latLng);

      });
      $('.jvectormap-zoomin').click(); //放大  
    });

I use svg produced a Jilin Province Map of China. I want to add several markers in the map But I can not get latLng ,And I don't know why ? Help!


Solution

  • Here is an example from the official site on dealing with markers for maps converted from SVG.