scottdejonge / map-icons

An icon font for use with Google Maps API and Google Places API using SVG markers and icon labels
http://map-icons.com/
MIT License
1.05k stars 198 forks source link

Label Appear without Showing Icon #64

Open afuzha opened 7 years ago

afuzha commented 7 years ago

i have put all require file like, dist/css/map-icons.css , dist/js/map-icons.js, then i make maker like this:

var marker = new google.maps.Marker( { position: myLatLng, map: map, icon: { path: SQUARE_ROUNDED, fillColor: '#00CCBB', fillOpacity: 1, strokeColor: '', strokeWeight: 0 }, map_icon_label: '' });

but icon is not appear, just label like this:

image

anyone can help me to fix this? thank you

uzenith360 commented 7 years ago

I'm having the same issue, any help?

fasidOnGit commented 7 years ago

Markers are created just like a normal Google Maps Marker, however, the class is extended for the map_icon_label property to add in markup for marker labels.

Note: You should be creating an instance of Marker rather than google.maps.Marker in order for the functionality added by map_icon_label to work.

var marker = new Marker({ map: map, position: new google.maps.LatLng(-27.46577, 153.02303), icon: { path: SQUARE_PIN, fillColor: '#00CCBB', fillOpacity: 1, strokeColor: '', strokeWeight: 0 }, map_icon_label: '' });

afuzha commented 7 years ago

i have try with

var marker = new Marker({

but if i use that, it not show anything...

fasidOnGit commented 7 years ago

@fuzha How are you using var marker ? . I mean you should be passing it along google.maps.event below is the one way of doing it. You can also pass it like google.maps.event.addListenerOnce(window , 'load , function(){ . please check the GoogleMap API to create simple map. `$scope.map=new google.maps.Map(document.getElementById("map") , mapOptions);

google.maps.event.addListenerOnce($scope.map , 'idle' , function(){
  var marker = new Marker({
    map : $scope.map,
    animation : google.maps.Animation.DROP,
    position : LatLang ,
    icon: {
           path: SQUARE_PIN,
    fillColor: '#0c60ee',
    fillOpacity: 1,
    strokeColor: '',
    strokeWeight: 0,
            scale: 5

},
map_icon_label: '<span class="map-icon map-icon-location-arrow"></span>' });

});`

If this dint fix. Please share the code or snippet if possible. Thanks.

afuzha commented 7 years ago

@fasidOnGit please review my code on https://codeshare.io/aJpBYZ

thank you...

SpinGit commented 7 years ago

Wow awesome project, well done.

But I having the same issue as well. In your example.html everything works well, but not in my angular 2 project.

var mapOptions = {
        zoom: 16,
        center: center,
        scrollwheel: false,
        mapTypeId: google.maps.MapTypeId.ROADMAP,
        styles: [
            {stylers: [{ visibility: 'simplified' }]},
            {elementType: 'labels', stylers: [{ visibility: 'off' }]}
        ]
    };
const marker =  new Marker({
      position: position,
      map: map,
      icon:  {
        path: ROUTE,
        fillColor: '#00CCBB',
        fillOpacity: 1,
        strokeColor: '',
        strokeWeight: 0
      },
      map_icon_label: '<span class="map-icon map-icon-transit-station"></span>'
    });
screen shot 2017-06-27 at 22 12 44

The font icon is shown on the upper left. Some CSS Issue?

DavoodAmini commented 7 years ago

I had the same issue. Adding codes and Script tags in the same order as Example worked for me.

SpinGit commented 7 years ago

The forked version of https://github.com/bmauser/map-icons works much better. Would be nice if the author should accept the pull request. :)

latifcakra commented 8 months ago

marker = new mapIcons.Marker({ map: map, title: markers[i][0], position: position, icon: { path: mapIcons.shapes.SQUARE_PIN, fillColor: '#c61f1f', fillOpacity: 1, strokeColor: '', strokeWeight: 0, },