Why won't my Google Map switch to terrain?

  • COREVI
    Asked on September 25, 2014 at 4:42 PM

    I have a google map on my form where users click on the location where an invasive fish was removed and the form translates that to a geolocation. The coding was acquired through this help forum. I haven't done any changes to the code, but now the map will no longer give the option to switch to terrain mode and the zoom controls are gone. This is bad news as users are selecting locations in the ocean which required the terrain feature. Please fix this!

  • Steve VP of Sales Operations
    Replied on September 25, 2014 at 8:33 PM

    Hello-

    I found the earlier thread where this was set up:

    https://www.jotform.com/answers/229804-How-to-Add-a-Geo-Marker-Google-Maps-Marker-for-Geolocation-purposes#45

    The sample GeoMarker page also does not have the terrain option:

    https://shots.jotform.com/dinesh/sampleGeoMarker.html

    If it used to work and now does not, then perhaps Google changed the API from the time this was set up. I'll research this a bit more to see if I can get the terrain option working. Will update this ticket with what I find.

    Thanks

  • COREVI
    Replied on September 27, 2014 at 1:47 PM

    Any update on the Google API? I would appreciate any insight into this as I'm losing data :(

  • Kiran Support Team Lead
    Replied on September 27, 2014 at 5:59 PM

    @COREVI

    We apologize for the inconvenience caused. Your message has reached Steve and hopefully he is working on the issue and get back to you when he finds some relevant information. Thank you for your patience.

    Thank you.

  • Steve VP of Sales Operations
    Replied on September 27, 2014 at 9:45 PM

    Hello-

    Thanks for the inquiry. I've been looking at the custom solution our colleague created for you previously. It looks like it needs adjustments since Google seems to have changed its map API. I haven't yet had a chance to explore it yet. I'll will check back early next week. We apologize for the inconvenience.

  • Steve VP of Sales Operations
    Replied on September 30, 2014 at 5:56 PM

    Hello-

    I think I just figured it out. We need to specify the version of Google API we're using. Please update the topmost script tag to the following:

    <script type="text/javascript" src="//maps.google.com/maps/api/js?key=AIzaSyDY0kkJiTPVd2U7aTOAwhc9ySH6oHxOIYM&sensor=true&v=3" />

     

    For reference here's where I found the resolution:

    http://stackoverflow.com/questions/25505754/google-maps-and-richfaces-3-3-3-prototype-js-1-6-0-3-possible-incompatibility

    Please let us know if this resolves your issue. Also note, I set the default view to HYBRID, which shows the topography of the ocean floor.

    Why wont my Google Map switch to terrain? Image 1 Screenshot 20

    You can find a working version here:

    http://jsfiddle.net/5ytkx/144/

     

  • Steve VP of Sales Operations
    Replied on September 30, 2014 at 6:01 PM

    Here's a better version of the sample code: http://jsfiddle.net/5ytkx/145/

  • COREVI
    Replied on October 4, 2014 at 12:19 PM

    Thank you so much for your help. I just copied the new code onto my website, but the map is just sitting awkwardly on top of my form, rather than in the form field where it should be. Also the hidden sections seem to be showing. I'll go back to the original version and see if I can work it out, but I wanted to share that. If somebody is looking at this withing the next few minutes it will still be on the wrong version, but then I'll put it back to the old one without the controls until I or someone else fixes it.

     

    EDIT - I took the top script from the first working code and that seems to have worked. I only copied the first script code and left the rest of the form alone.

    In the future I'd love to

    see if we could add one of those little arrows you press to zoom in on your current location, but right now I'm just happy something is working again.
  • Steve VP of Sales Operations
    Replied on October 4, 2014 at 4:54 PM

    Hello-

    Yes, I realized after posted that that I had included a debug version of the code. Glad you figured it out.

    The only other change you might also want is to update the default view to HYBRID. It's the only one that shows the terrain of the ocean floor, I believe.

    mapTypeId:google.maps.MapTypeId.ROADMAP


    update to this, if you like:

    mapTypeId: google.maps.MapTypeId.HYBRID

    You'll find a list of all the options here:
    https://developers.google.com/maps/documentation/javascript/maptypes#MapTypes

    I created a new thread for your other request to add one of those arrows you press to zoom in on your current location. We'll investigate if we can set that up.

    http://www.jotform.com/answers/438721

  • COREVI
    Replied on January 5, 2015 at 3:44 PM

    Hello, my map is broken again. For some reason the controls disappeared on the map, so I went back to this thread and found the source of the fix and tried to do it on my own. I now have a completely f***** form. I honestly don't even know where to ask for help. Could somebody PLEASE look at my code and see where I messed up? The live form is www.corevi.org/submit.html 

  • COREVI
    Replied on January 5, 2015 at 4:05 PM

    Thanks, I am copying the code now. I have a meeting in 55 minutes with the people who use this form so I hope to get it working!

  • COREVI
    Replied on January 5, 2015 at 4:07 PM

    http://pastebin.com/7K5qWWzd

  • Ben
    Replied on January 5, 2015 at 4:39 PM

    Hi,

    Thank you for the link.

    Upon looking it seems that you had removed the ID which is used to find the element where the map should be:

    <div>
      Mark your DIVE LOCATION on the map!
      <div style="width:100%;height:527px;background:#5A8E4A;">
       Map
      </div>
    </div>

    should be:

    <div>Mark your DIVE LOCATION on the map!
    <div id="googleMap" style="width:100%;height:527px;background:#5A8E4A;">Map</div>
    </div>

    You can see and copy the code from here: http://pastebin.com/DxkwkpRa

    Do let us know if you have any further questions.

    Best Regards,
    Ben

  • COREVI
    Replied on January 5, 2015 at 4:43 PM

    Thank you! The only problem (related to this thread) is that the controls aren't showing. Do you know the code to add those in?

  • Ben
    Replied on January 5, 2015 at 5:19 PM

    Hi,

    You are welcome.

    Unfortunately I was not able to find the reason why the controls are not shown. I am not that familiar with Google Maps so that might require some time to find although I have check several forum posts and tried to fix it through CSS, which did not seem to work. The same was with the following js options:

    disableDefaultUI: false,
    panControl: true,
    scaleControl: true,
    zoomControl: true,
    zoomControlOptions: google.maps.ZoomControlStyle.SMALL

    I have also tried including v=3 in the URL of the script and setting the sensor to false, but as mentioned, it did not seem to work.

    If we find anything that would work, we will update you through this thread.

    Best Regards,
    Ben

  • COREVI
    Replied on January 6, 2015 at 8:00 AM

    I've been playing with it and I can't find anything that works. I'm working with a large range of user groups and many of them don't know how to zoom without the controls so getting this fixed is VERY important. Please let me know as soon as anything is discovered.

  • Ben
    Replied on January 6, 2015 at 9:24 AM

    Hi,

    We will update you if we find any updates through the other thread opened in regards to this (http://www.jotform.com/answers/438721), however as this is a full source code implementation with a bit complex modification we can not offer you the same support as if you are using our widgets through unmodified jotform.

    Having that said we will still update you in case we end up finding something that would work, but as mentioned due to the complexity and it being source code implementation we can not give it the same priority as if you were using the unmodified jotform.

    Best Regards,
    Ben