Skip to main content
Known Participant
August 31, 2011
Question

CFMAP to disable panning in Google?

  • August 31, 2011
  • 1 reply
  • 1748 views

Hello,

I have a Google Map embedded in my website using cfmap. I would like to "lock" the map location, or disable panning so the user can not move where the map is centered. Is this possible using cfmap? I have tried to use the disableDragging() javascript function with no luck...any suggestions?

<cfoutput>
  <cfmap centeraddress="#lat#, #long#" width="400" height="400" zoomLevel="18" type="hybrid"  scrollwheelzoom="false" showCenterMarker="false" overview = "false" >
  <cfloop query="mrs2">
  <cfmapitem latitude="#lat#"
        longitude="#long#"
  tip="#POINT_NAME#">
  </cfloop>
  </cfmap>
     </cfoutput>

Thanks!

    This topic has been closed for replies.

    1 reply

    Inspiring
    August 31, 2011

    Interesting.  I don't think one can do it with CFMAP.

    It might be worth raising an enhacement request of Adobe:

    http://cfbugs.adobe.com/cfbugreport/flexbugui/cfbugtracker/main.html

    And then look throught eh Google API, as I am sure there'll be a way to do it (I shall research this myself...)

    --
    Adam

    Inspiring
    August 31, 2011

    I consulted with my resident Google maps expert, and he pointed me to this:

    http://code.google.com/apis/maps/documentation/javascript/reference.html#MapOptions

    Which looks like stuff you've already read.  He was bemused at why the disableDragging thing didn't work for you.

    Could you produce some self-contained and stand-alone code that shows how you were trying this?  I'll give me something to go on.

    He also pointed me to this:

    http://code.google.com/apis/maps/documentation/staticmaps/

    That could be an option?  Possibly too restrictive for what you want.

    --

    Adam

    Inspiring
    September 2, 2011

    Sorry about that Adam. Here are the relevant pieces code. I know the javascript part is not correct, but it is all I have at the moment:

    <script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script>
      <script type="text/javascript">

    </script>

    function initialize() {
         var map = new GMap2(document.getElementById('map'));       
            // disable map dragging
    map.disableDragging();  
           
        }


      <cfoutput>
      <cfmap centeraddress="#lat#, #long#" width="400" height="400" zoomLevel="18" type="hybrid"  scrollwheelzoom="false" showCenterMarker="false" overview = "false" >
      <cfloop query="mrs2">
      <cfmapitem latitude="#lat#"
            longitude="#long#"
      tip="#POINT_NAME#">
      </cfloop>
      </cfmap>
         </cfoutput>


    Hi Emily.

    I haven't forgotten about this. I could get the disableDragging() method to work, but not onload, only when clicking a link to execute the call. It's something to do with how CFMAP pulls in the google stuff I think. I tried using JQuery's document-ready approach but I still could not access the CF wrapper object for the map. I'm not beaten yet though.

    That said, perhaps it'd just be quicker and easier to just do it all with the Google API entirely, rather than a hybrid of CF & Google API. CF's version of the API is obsolete, for one thing.

    There's an easy-to-follow tutorial here: http://marcgrabanski.com/articles/jquery-google-maps-tutorial-basics

    I'll report back if/when I crack it with CFMAP.

    --

    Adam