8 Replies Latest reply on Jul 15, 2016 7:54 AM by wacole1213

    Google Map Zoom in Web Viewer: Doesn't Work

    wacole1213

      I have the following entered in the Web Address field of the Web Viewer.  The switch is to distinguish between maps which have Street Address data and those that have Lat/Long data.  It works OK, except for the Zoom field.  I have set that field [BurgessPlaces::bp_map_zoom] as a Number.  Regardless of what I enter to this field, the displayed map defaults to the default Google Map zoom value - which, I think, is 15.  What am I doing wrong, please?  [Oh, I've tried both &z= and &zoom=.  Neither works.]

       

      I claim no originality as I copied the web address - modified for my application - from FileMaker Custom Function:fnGoogleMap (Address; City; State; Zip; Zoom)

       

      If (BurgessPlaces::bp_map_switch = "Street";


      "http://maps.google.com/maps?q=" & /*Address=*/ BurgessPlaces::bp_map_address & "," & /*City=*/ BurgessPlaces::bp_map_city & "," & /*State=*/ BurgessPlaces::bp_map_state & "," & /*Zip Code=*/ BurgessPlaces::bp_map_zip & "," & /*Country=*/ "US" & "&zoom=" & /*Zoom= */ BurgessPlaces::bp_map_zoom & "& output=embed&iwloc=0"

      ;

      "https://maps.google.com/maps?q=" & /* Lat= */ BurgessPlaces::bp_geocoord_north & "," & /* Long= */ BurgessPlaces::bp_geocoord_east & "&zoom=" & /*Zoom= */ BurgessPlaces::bp_map_zoom & "& output=embed&iwloc=0")

       

      Thanks very much ...

        • 1. Re: Google Map Zoom in Web Viewer: Doesn't Work
          schamblee

          /* means comment, so items in between /* is ignored. 

          zoomfield would be a number field

          It should be   "&zoom=" & zoomfield

          • 2. Re: Google Map Zoom in Web Viewer: Doesn't Work
            wacole1213

            Thanks, but the whole zoom piece is "&zoom=" & /*Zoom= */ BurgessPlaces::bp_map_zoom; if you take out /*Zoom=*/ -  which is there for documentation - then you are left with "&zoom=" & BurgessPlaces::bp_map_zoom, which, I think is no different from what you noted it should be.  Maybe I am wrong?

            • 3. Re: Google Map Zoom in Web Viewer: Doesn't Work
              schamblee

              The comment is most likely what is causing the issue.    I would add the commenting at the end of the complete script.  "&zoom=" & zoom  does work.  I have use and I have tested.

               

              Here is the calculation I use

               

               

              Let (
              [
              address = Substitute (
              caddress& " " &
              ""& " " &
              ccity & " " &
              cstate & " "&
              czip & " " &
              " " ;
              " " ; "+"
              ) ;
              size = GetLayoutObjectAttribute ( "Map1" ; "width" ) & "x" & GetLayoutObjectAttribute ("Map1" ; "height" )
              ] ;

              "data:text/html,

              <body style='border=0;overflow:hidden'>
              <body topmargin=0>
              <body leftmargin=0>

              <img src='https://maps.googleapis.com/maps/api/staticmap?center=" &
                     address &
                    "&zoom=" & zoom &
                    "¶" &
                     Markers &
                    "¶"&
                    "&size=" &  size &
                    "&maptype=" & MapType &"' >
              </body>"

              )

              • 4. Re: Google Map Zoom in Web Viewer: Doesn't Work
                wacole1213

                I removed all of the comments per below and got the same result; no zoom.  I'll give your method a try and let you know what happens.  Thanks for your advice and patience.

                 

                If (BurgessPlaces::bp_map_switch = "Street";


                "http://maps.google.com/maps?q=" & BurgessPlaces::bp_map_address & "," & BurgessPlaces::bp_map_city & "," & BurgessPlaces::bp_map_state & "," & BurgessPlaces::bp_map_zip & "," & "US" & "&zoom=" & BurgessPlaces::bp_map_zoom & "& output=embed&iwloc=0"

                  ;

                "https://maps.google.com/maps?q=" & BurgessPlaces::bp_geocoord_north & "," & BurgessPlaces::bp_geocoord_east & "&zoom=" & BurgessPlaces::bp_map_zoom & "& output=embed&iwloc=0")

                • 5. Re: Google Map Zoom in Web Viewer: Doesn't Work
                  schamblee

                  Your url does not look much different than mine.  I know it works.

                   

                  Here is a sample copy. 

                  Dropbox - GoogleMapsSample.fmp12

                  • 6. Re: Google Map Zoom in Web Viewer: Doesn't Work
                    wacole1213

                    Not being a true coder, I broke down the sample you sent me to make sure that I might understand how to approach modifying it.  The following is a line-by-line analysis.  There are some places where what might be going on is unclear to me.  The highlighted ones are particularly mysterious.   Many thanks for the advice and help.

                        

                    CodeAnalysis
                    1Let ( [ bp_address = SubstituteLet( FM function
                    2 bp_address is a local variable used on line 31
                    3 Substitute <<key word?>>
                    4 ( caddressProbably street address [ street no, street name, cardinal direction]. Caddress is a field.
                    5& " " space
                    6& ""null
                    7& " " space
                    8& ccity City name. Ccity is a field.
                    9& " " space
                    10& cstate State abbreviation. Cstate is a field.
                    11Object space
                    12& czip ZIP Code. Czip is a field.
                    13& " " space
                    14& " " ; " " ; looks like two spaces?
                    15"+"
                    ?
                    16) ;Close parens from line 4
                    17size = GetLayoutObjectAttribute ( "Map1" ; "width" ) & "x" & GetLayoutObjectAttribute ("Map1" ; "height" )Size = Size is a field?
                    18 GetLayoutObjectAttribute ("Map1" ; "width" ) & FM function. Map1 is name of object. “width” is attribute value – which would be either a field or a number.
                    19 “x” & Have no idea what x is for?
                    20 GetLayoutObjectAttribute ("Map1" ; "height" ) FM function. Map1 is name of object. “height” is atrribute value – which would be either a field or a number.
                    21] ;Close bracket from line 1
                    22 blank line
                    23"data:text/html,html declaration
                    24 blank line
                    25
                    <body style='border=0;overflow:hidden'>
                    html:
                    26<body topmargin=0>html:
                    27<body leftmargin=0>html:
                    28 blank line
                    29Begin Google Maps API Statements
                    30<img src='https://maps.googleapis.com/maps/api/staticmap?center=" &html: url is for Google Map. 
                    31 bp_address &bp_address from line 1
                    32 "&zoom=" & Zoom &GM zoom statement. Zoom is field
                    33 "¶" &paragraph
                    34 Markers &Markers is a field. Assume this is a GM attribute
                    35  "¶"&paragraph
                    36 "&size=" & Size & GM size statement. Size is a field
                    37 "&maptype=" & MapType &"' >GM maptype statement. MapType is a field.
                    38End Google Maps API Statements
                    39</body>"html:
                    40)Close parens from line 1
                    • 7. Re: Google Map Zoom in Web Viewer: Doesn't Work
                      schamblee

                      The x is for size =  width x height.    The "" are for other options such as country could be inserted instead.   The calculation has changed over time as I have modified my sample database.   The sample database, scripts, calculation and etc.  could be cleaned up but I haven't had time.    It has been a work in progress, adding new features when I have time.   

                      • 8. Re: Google Map Zoom in Web Viewer: Doesn't Work
                        wacole1213

                        Thanks very much for the clarification and for taking the time to put this together.  Very good learning tool.  Now to work on understanding how all the parts work together.