Platform
Learn
Community
Support
Sign up
or
Log in
Profile
messages
Messages
logout
Logout
Platform
Home
Downloads
IPP
Licensing
Project Sizing
Beta
Learn
Training
Documentation
Evaluation Guide
Community
Jobs
Home
Forums
Forge
Ideas
Badges
Members
Support
Partner Guide
Resources Library
Opportunities
Account Management
Pre Sales Demos
Sign up
or
Log in
Home
Jobs
Forums
Forge
Ideas
Members
Badges
Dear ,
What would improve your OutSystems Community experience? Let us know by taking this 2-minute survey.
Pick up the survey
Community
›
Forums
›
Forge Discussions
[Google Maps] Can't add directions
New Post
New Post
Forge Component
Google Maps
(25)
Published on 2018-10-18 by Labs
25 votes
Published on 2018-10-18 by Labs
Robrecht Colson
Posted on 2016-01-19
Robrecht Colson
Rank: #387
Posted on 2016-01-19
Hey folks,
I have a WebScreen that has a RouteMap, three inputs (Duration, Origin, Destination) and an AddMapDirections WebBlock. I also have a hidden button that gets clicked on page load. This translates coords from navigator.geolocation to an address for the origin and refreshes the Origin input and the AddMapDirections WebBlock.
However, whenever this page gets loaded, I get two errors - one is that an argument was empty and directions can't be loaded. The other is after the AJAX refresh happens - the AddMapDirections can't find the RouteMap, even though that never gets refreshed. In short, I don't know how to fix this and I was wondering if anyone could help me out. I've looked at the demo code extensively and can't seem to figure it out.
E: After adding the map to the AJAX Refresh, I still get the errors, but at least the route shows up. I'd still appreciate help in getting the errors removed. Thanks in advance! :)
Kind regards,
Robrecht
Carlos Simões
Posted on 2016-01-19
Carlos Simões
Rank: #253
Posted on 2016-01-19
Solution
Robrecht Colson
wrote:
Hey folks,
I have a WebScreen that has a RouteMap, three inputs (Duration, Origin, Destination) and an AddMapDirections WebBlock. I also have a hidden button that gets clicked on page load. This translates coords from navigator.geolocation to an address for the origin and refreshes the Origin input and the AddMapDirections WebBlock.
However, whenever this page gets loaded, I get two errors - one is that an argument was empty and directions can't be loaded. The other is after the AJAX refresh happens - the AddMapDirections can't find the RouteMap, even though that never gets refreshed. In short, I don't know how to fix this and I was wondering if anyone could help me out. I've looked at the demo code extensively and can't seem to figure it out.
E: After adding the map to the AJAX Refresh, I still get the errors, but at least the route shows up. I'd still appreciate help in getting the errors removed. Thanks in advance! :)
Kind regards,
Robrecht
Hey there, Robert,
Let me start by saying I would use a regular map in that specific case: AddMapDirections will add a route to a map by itself, so I'm not sure why you need a Route Map. After translating the coordinates to an address and calling AddMapDirections, you should have a map with the route you want. If you don't want to show the map until you have the route ready, you can hide the Map inside an If and then switch its value and refresh it.
However, since I don't know the specific errors you have, it's hard for me to understand if this solution will solve everything. Can you please be a bit more specific on both errors? Maybe provide me with an URL I can look at?
Best regards,
Carlos Simões
Solution
Robrecht Colson
Posted on 2016-01-19
Robrecht Colson
Rank: #387
Posted on 2016-01-19
Solution
Thanks for the help, Carlos. I replaced the RouteMap with a regular map, and I got the routes to show up, but I'm still getting the errors. You can check them out
here
. The application doesn't save your coordinates so you don't need to worry about privacy issues :)
Kind regards,
Robrecht
Solution
Carlos Simões
Posted on 2016-01-20
Carlos Simões
Rank: #253
Posted on 2016-01-20
Solution
Robrecht Colson
wrote:
Thanks for the help, Carlos. I replaced the RouteMap with a regular map, and I got the routes to show up, but I'm still getting the errors. You can check them out
here
. The application doesn't save your coordinates so you don't need to worry about privacy issues :)
Kind regards,
Robrecht
Ok, Robrecht (sorry for the typo back there :P),
Looking at your page's DOM, I can see you are using a AddDirections block, along with 'navigator.geolocation'. Last time I checked, this JS variable took some time to return a valid value, which might not be ready the first time the page (including the AddDirections block) is rendered.
Can you try adding directions through the appropriate AddDirections action instead? A good spot to place it would be at the end of the flow of the hidden button's click handler.
If this doesn't cut it, could you please send me the eSpace so I can have a look? One with just the problematic screen would do, if you're concerned with the recipe of your secret sauce ;).
Hope it helps!
Carlos Simões
Solution
Robrecht Colson
Posted on 2016-01-20
Robrecht Colson
Rank: #387
Posted on 2016-01-20
Solution
Haha, no worries - my name is Robert, only in Dutch ;).
Using the action instead of the web block worked - placing it at the end of the hidden button's click handler worked perfectly. Many thanks for the help!
Kind regards,
Robrecht
Solution
Login to reply
New Post
Available Forums
Technology & Integration
News and Announcements
Forge Discussions
Meta
Hints and How-To Guides
Usability
Installation Troubleshooting
Personal Environment Troubleshooting
Forum Notifications
Email Digest Settings
Loading...
(hidden) New Badge Popup