6 Replies Latest reply on Feb 28, 2013 4:50 PM by pthomas

# Web Viewer with GPS

Hi All!

Last time I used a webviewer via Google Maps, everything worked great. Now I am dealing with a non-US address: farms in the Dominican Republic instead.

Google Maps - US and Google Maps - UK do not find my address. I will also have access to a GPS location, but is there a way to generate a map of this?

Thanks for any help.

• ###### 1. Re: Web Viewer with GPS

You should be calculating URLs at this point rather than using the built in link builder:

The calculation would look something like this:

&

Substitute( table::address ; " " ; "+" )

& "+" &

Substitute( table::city; " " ; "+" )

& "+" &

Substitute( table::state ; " " ; "+" )

& "+" &

Substitute( table::country ; " " ; "+" )

You can make this more complex, basically you just look at the URL that google maps gives you and replace the parts of the link with fields from your database.

• ###### 2. Re: Web Viewer with GPS

Thank-you so much. That was extremely helpful and is now doing what I expected. I am curious if I can apply a line about the GPS location too, if that isn't too picky:: Have you seen that before?

• ###### 3. Re: Web Viewer with GPS

Hi Michele,

Below is the code I use in our iPad database to determine the route between a client address and the GPS location of the iPad - is that what you are after?

Set Variable \$Location =

Location ( 100 ; 40 )

Set Variable \$Latitude =

Let (

[

\$W = \$Location ;

\$P = Position ( \$W ; "," ; 1 ; 1 ) ;

\$N = \$P - 1 ;

\$S = 1

] ;

Middle ( \$W ; \$S ; \$N )

)

Set Variable \$Longitude =

Let (

[

\$W = \$Location ;

\$P = Position ( \$W ; "," ; 1 ; 2 ) ;

\$S = Position ( \$W ; "," ; 1 ; 1 ) + 2 ;

\$N = \$P - \$S

] ;

Middle ( \$W ; \$S ; \$N )

)

OpenURL =

"http://maps.google.com/maps?daddr=" & Clients::Street_No & "+" & Clients::Street_Name & "+" & Clients::Street_Typ & "+" & Clients::Location Town & "+" & Clients::Location State & "&saddr=" & \$Latitude & " + " & \$Longitude

Cheers,

Paul.

• ###### 4. Re: Web Viewer with GPS

This is great code Paul, thanks for sharing!

• ###### 5. Re: Web Viewer with GPS

That's awesome.

The records will mostly be filled in on site with an iPad, but there may be the occasion of someone plugging in a list far away from the site at a desktop. In which case the GPS coordinates would need to be edited. I planned on having the Address listing and a place to write the coordinates: perhaps this is generated automatically by this code? Is this code put in the web viewer?

Thanks so much for your help Paul!

-michele

• ###### 6. Re: Web Viewer with GPS

Hi Michele,

In our implementation I am not using a webviewer. I have that code set up in a script, and a button to call that script.

When the button is pressed FileMaker opens the URL in a browser window.

You could probably set it up with a webviewer though, just set the webviewer address to be:

"http://maps.google.com/maps?daddr=" & Clients::Street_No & "+" & Clients::Street_Name & "+" & Clients::Street_Typ & "+" & Clients::Location Town & "+" & Clients::Location State & "&saddr=" & \$\$Latitude & " + " & \$\$Longitude

The only change required would be to make the Latitude and Longitude variables global variables so they can be referenced outside of the script that sets them (alternativly you could have the script enter the values into global fields and reference those from the web viewer).

You would still need a script to populate the variables/global fields.

If you are wanting to give the user the ability to enter the coordinates themselves then I would lean towards setting up global fields somewhere, your script could populate them based on the location of the iPad, but then give the user the ability to enter their own values if they want.

Cheers,

Paul.