facebook

Custom Map – Help Needed : CLOSED

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

    Hi Mike,

    I didn’t remember you were using AJAX as default page architecture. You need to set the location and your marks in the pretransition function. Doing it as first examples where the map location is set in the readyHandler function the content of secondary screens is not loaded in the DOM yet, so, the location and add the marks can’t be changed.

    Something like this should do the trick:

    phoneui.prePageTransition = function(currentScreenId,targetScreenId) {
      // add custom pre-transition code here
      // return false to terminate transition
      
      if(targetScreenId=="#m1-showMarkers"){
      
          $('[id$=map1]').gmapready(function(gmap) {    
            var centerPos = new google.maps.LatLng(39.48071,-106.04612);
            gmap.setCenter(centerPos); 
            var pos1 = new google.maps.LatLng(39.48222,-106.04615);
            showMarkers(gmap, pos1);
        });
        
      }
      
      return true;
    }

    I can post a complete and optimized code for many screens if you need it.

    #339287 Reply

    Mikelv001
    Member

    Octavio-

    Thank you for your help.

    I’ll be honest – although I have 4 apps up and selling in Itunes, I’m a rank amateur when it comes to code – that’s why I selected mobione in the first place 🙂 I’ve taken programming classes in the past, but I don’t know js…..so I’d appreciate a little more help because your last note has me essentiially lost. Can you drop in the code above into your previous sample map screens tailored for AJAX, and from there I should be able to reverse engineer for my app.

    Thank you for your help, and I am a fairly quick study on this stuff!!

    Mike

    #339311 Reply

    Mikelv001
    Member

    Octavio-

    I cut and pasted your code at line 22 of your sample home screen js file, reran in the test center, and map 1 correctly navigates to Colorado – woo hoo! But no markers 🙁 even if I zoom out.

    What am I doing wrong?

    Thank you 🙂

    Mike

    #339389 Reply

    Hi Mike,

    Let’s go back to the last example I shared: http://www.genuitec.com/support-genuitec/viewtopic.php?p=17585#p17585

    The maps couldn’t be initialized since all screens are configured with default page arch, un your case it was ajax. Discussing with Wayne we agreed that is better to set your map screen with a static arch, so the map can be populated when the app is lanched. Please use the example mentioned aboved and change the arch of showMarkers.mobi to static, you’ll realize that now the Map and markers in that screen are rendered fine, the same thing will happen with the other screen if you configure it in the same way. This can bring you problems if you plan to use many maps, can you share how many maps will your app use? Also, please let me know if the map and markers are rendered well for you with the changes I suggested.

    #339457 Reply

    Mikelv001
    Member

    Hi Octavio-

    The app is in AJAX, because that was your advice to avoid jerky scrolling. I rebuilt the app without AJAX, and the scrolling is ‘ok’ – it’s not silky smooth, but it is a little jerky. When the map issue came up a month ago, I sent the entire app, so you have it. Is there a way to solve my map iss ue with the silky scrolling. Agaiin, the map has 75 maps for each retail location, and those maps are fine – they contain a single marker based upon a single address. There is only 1 map with custom markers – 1 map of the entire european continent with 75 markers (for each location).

    Let me know your thoughts.

    Mike

    #339476 Reply

    Hi Mike,

    I have escalated your issue to Wayne/Dev Team since I’ll be off since this afternoon. They will follow up with you tomorrow.

    #339683 Reply

    Hi Mike,

    We haven’t forgotten you. We have escalated your case to dev team to provide the best advice. Will follow up with you as soon as I get more information.

    #339878 Reply

    Hi Mike,

    We found a bug that we have fixed today in remote screen loading with maps that was causing a problem. We will share a code snippet or example that discusses how to initialize a map later today or tomorrow.

    #340144 Reply

    Mikelv001
    Member

    Octavio-

    Anything yet?

    Mike

    #340393 Reply

    Hi Mike,

    Here is the first example that I shared with you in previous replies, it contains two maps in two secondary screens. One with two markers and other one with only marker. Take a look at the code at the begining with the maps data information:

    var marksMap1 = [
      {name : "Mark1" , info:"position 1 info" , lat : 39.48222, lng: -106.04615},
      {name : "Mark2" , info:"position 2 info" ,lat: 39.47730, lng: -106.04504}
    ];
      var map1 = {lat: 39.48071, lng:-106.04612, arrayMarks: marksMap1, init:false};
    // ** End of Map 1 data
    
    var marksMap2 = [
      {name : "Mark3" , info:"position 3 info" ,lat: 40.7121, lng: -74.0062}
    ];
    var map2 = {lat: 40.7174, lng:-74.0060, arrayMarks: marksMap2, init:false};
    // ** End of Map 2 data

    And the function that do the trick is centerMap, that receives an map object that was populated with previous info.

    This function is called when you enter to showMarkers screen or showMarkers2 screen. So, you should add more comparisons if you add more map screens. For the map with the 70 maps should work in the same way, but you should populate its map var with as many markers as you need.

    phoneui.prePageTransition = function(currentScreenId,targetScreenId) {
      
        if(targetScreenId=="#m1-showMarkers"){
        
        if(!map1.init)    
          centerMap("map1",map1);
        } else if(targetScreenId=="#m1-showMarkers2"){
          if(!map2.init) {
            centerMap("map2",map2);
          }
        } //else if
      
      
      return true;
    }

    Lastly, note that this also work using the AJAX arch. Please give it a try and let me know if you have any question about the code.

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

    mattie63
    Participant

    Hi Octavio

    This is exactly what i would like to do, but also using an image instead of an actual map.
    would this be possible?

    I have tried to find where it is in your very fine att.”showMarkers-example-modified-multiple maps and marks.rar”
    the code you made is.
    thanks

    #342357 Reply

    Hi Mattie,

    Can you please open a new thread with more details about what you are trying to achieve? Maybe a couple screenshots?

    Doing a similar thing that previous example but without using maps should be easy and wouldn’t need much code, but it’s better to understand well your requirements so we can give you an accurate advice.

    #342716 Reply

    mattie63
    Participant

    @support-octavio wrote:

    Hi Mattie,

    Can you please open a new thread with more details about what you are trying to achieve? Maybe a couple screenshots?

    Doing a similar thing that previous example but without using maps should be easy and wouldn’t need much code, but it’s better to understand well your requirements so we can give you an accurate advice.

    I have opened a new thread here: http://www.genuitec.com/support-genuitec/viewtopic.php?f=8&t=6120

Viewing 13 posts - 16 through 28 (of 28 total)
Reply To: Custom Map – Help Needed : CLOSED

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