facebook

Map Widge API change – Please show us a working example

  1. MobiOne Archive
  2.  > 
  3. Getting Help – General
Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #346049 Reply

    Hi,

    I’ve been playing around with the new Map Widget API, but the example you posted here: http://www.genuitec.com/mobile//docs/highlights/2.6.0/#sec5 do not work.

    Can you please post a working example.

    Thanks.

    #346062 Reply

    support-michael
    Keymaster

    The snippet on the features page mistakenly omitted assigning the new marker’s map property, setMap(theMap).

    The markersArray parameter in gmapready(gmap,markersArray) consists of all the markers in the order they were added to the map. Adding or removing markers from this array has no effect on the markers displayed on the map. It is a convenience structure to simplify accessing map markers. You can show or hide a marker using setMap(null) or setMap(aMarker) respectively.

    //example, get map container
    var mapContainer = $(‘[id$=mapWidget]");
     
    mapContainer.gmapready(function(gmap, markersArray) {
      // hide all markers on the map:
      while (markersArray.length) {
          markersArray.pop().setMap(null); //setting to null hides marker
      }
       
      //create new marker
      var marker = new google.maps.Marker({
           position: location,  //location creation not shown map: 
           map: gmap           // ****** set the marker's map - will be visible 
          });
      
      //alternative way to set marker's map property - marker will be visible 
      marker.setMap(gmap);
    
      //add new marker to markersArray for future access and return
      markersArray.push(marker);
    });
    #346143 Reply

    Hi,

    I’m struggling with the news map widget and would appreciate some help 🙂

    I’m trying to create a map where i want some markers, the marker info is stored in an array.

    I’ve managed to have the markers on the map, and showing the title for each marker – But I cant click on the marker.

    Here’s my problems:

    1. I cant click on the markers

    2. Markers from previous “visit” on the map page is still there, when I return.

    3. I dont understand why the markers is shown in the first place, because I dont use the “markersArray.push(marker)”

    See attached project..

    Kind regards
    TKT

    Attachments:
    You must be logged in to view attached files.
    #346297 Reply

    Hello Support – Are you there?

    I could really need some help – cant you provide us with full documentation for the new map widget.
    Eg. how to put multiply markers and delete them again. How to make clickable infobox, ect.
    If I want to change zoom level depending om data in the app, how can I do that.

    I can’t get it to work – and the documentation – well it’s not very detailed.

    And how is it different from default google (API 3.0)

    Thank you

Viewing 4 posts - 1 through 4 (of 4 total)
Reply To: Map Widge API change – Please show us a working example

You must be logged in to post in the forum log in