I have two Google Maps. On the first I have the marker showing on Current Geographical Location so I user can save their current position into the database. All works well
The other map allows the user to choose a different location from the map other than their current location. I therefore show a different map with the maker as the centre address.
Each time the map loads it centres to New York. This is not acceptable as it is far too difficult to move the map for Australian or European users (or anyone else rather than New Yorkers). I therefore used a workflow to adjust the zoom and centre the map on the current geographical position. This makes it easier (in theory) for the user to then choose a location at least in the same continent or country or even state or city as their current location.
Logic would tell me that both maps would show the same location (that is current location). The first one shows OK but the second map continually puts my location in the middle of the pacific ocean nowhere near my current location (East Coast of Australia). The zoom will not allow me to move the 1000’s of kilometres or miles I need to move the marker to find the location I want to save. Adjusting the zoom level does not help
Anyone have any thoughts on what I am doing wrong???
Try adding :extract County or City. In Romania it works for County, not City. If I use City and it’s not the capital, so that city has a county that it’s in, it will show antarctica lol.
Thanks @mvandrei but that did not work. I added extract Country and all I got was somewhere in far north Canada when I am on the east coast of Australia. The other map where the marker address is current geographical address work correctly. So it is only when I choose for the marker to be the map’s centre address and then do a workflow for it to centre on the current position that I have the problem
Have you checked what the current Geographic Position in that case actually returns? For example by displaying it in a text field, or checking it in the debugger. It might get you closer to a solution if you know if it’s the wrong coordinates, if it’s empty, etc.
Also you could try saving the first instance of Current […] in a state, and fetch it from there instead. If there’s a bug in the map element, you might be able to circumvent it that way.
Thanks @petter. The debugger and editor show the current geographical position as correct (or very very close which is good enough for the purpose) so even more intriguing as to why the webview page show incorrectly.
I do not want to save the result. I just want the user to be able to move the map around to find the position they want (it may not have a formal address that can by typed into a search bar). Current position just gets it away from New York (which appears to be the default at where it loads) and closer to the position the user wishes to save
Yes, I assumed you did not want to save the result. What saving it in a state means is not saving it in the database, but only keeping it as a variable in the app memory until you close it.
The reason I suggested it is that it might help you determine if the wrong position comes from the fetching of the Current Geographic Position. If so, loading the previous call from a State might solve it.
Thanks @petter, @mvandrei and @NigelG for your help on this. Sorry it has taken so long to get back but I have been away for a week.
I have duplicated the page in my app here but simplified it a bit just to show the issue forum4 | Bubble Editor
So just to recap. The goal is for the user to be able to save their campsite location. To do so they can choose their current location, type the address in a search bar (this function works well so I have not included it here in this mockup) or when the campsite does not have a physical address I want them to be able to pinpoint (or choose) the location on a map. A different map shows depending on what option you choose (in the mock up the maps are side by side to show the different locations but in my app only one map will show). The Choose Location map works well if your campsite is in New York or somewhere close to there as the map always centres on New York. The user will then move the map around to centre it on their campsite location and the correct address will save. But when the user is not in New York you can not get the map to zoom enough and move to move the centre address to another continent. To get over this issue I added a workflow so that when Map B is showing it should centre on current location (which will the centre the map much closer to their campsite than New York then they can move the map around to centre it on the campsite’s location). When saved the centre address will be what is saved
This is the result I get (for the purposes of this screen shot I have both maps showing. In the real app and in the mock up I only have the map showing for the chosen radio button)
So as far as I can tell I should get the same location on both maps - that is my current location - but I get somewhere in the middle of the pacific ocean on Map B
I hope this explains it all better and you can help me with a solution
I just tested it on my computer, and it worked fine - both maps show my current location.
It leads me to suspect there might be a glitch in your browser, or your computer. Have you tried running it on more than one computer/mobile, or trying it in a different browser?
Thanks again @petter and @NigelG. Still have issues. An ipad on safari shows the same issue so not browser related. I note the first two fields that you have added @NigelG are correct. When I click on the Choose location option two addresses flash up in the 3rd field momentarily then the map loads in the same position in the middle of the ocean. The first address that flashes is New York and the 2nd is my current location so it appears all the workflows are correct - it is just the map not showing correctly still
I then found if I removed Map B’s marker address (I had it set on Map B’s centre address) the map now shows my current location correctly but without a marker it is just a little more difficult to pinpoint. It also saves correctly with the correct address at what appears in the middle of the map. I suppose I can accept this but would prefer to see a marker to be most accurate
Update - it is definitely the map that is the issue. The correct address is saving to the database but the map is showing incorrectly. And I have now found it is data from both maps showing incorrectly. With both Current Location map and Choose Location map the correct address saves correctly to the database but the map now showing the resulting campsite is showing incorrect.
You can see in the screenshot above the location in text is correct. The location on the map is incorrect. The data in both the text and the maps marker address is the same - that is Campsite Location
Thanks @NigelG I really do appreciate your help on this issue. Whilst your idea does get the desired result of showing current location it then does not allow the user to move the map to the desired location - remember I simply want the map to centre on the current location to be closer to the desired location, as in at least the same continent, to make it easier to scroll and zoom to the desired location.
I have further developed the mock page to show a very simplified version of what I show in my app. I have now added Map G that does not have a marker address stipulated so no marker appears on the map. To overcome this I now show the maps centre address in text below the map. This is what saves in the database when Choose Location on Map is the chosen option.
After the campsite is saved the data shows in a repeating group and a map of all campsites. From this the user can choose a campsite from the repeating group and the detail will show in the last group - Campsite Detail
So in the database all Campsite locations are correct so the saving of the data is not an issue. It is the maps that are the issue. the only Map that shows correctly is for the one that was typed. For those saved from the maps the map is showing incorrectly. The unnamed road in Fiji was basically as far as I could reasonably zoom and scroll to find any land near the pined location.
Please add some locations and see if you can come up with a solution for me or is it a bug with the Marker address on the map
Ah, ok. Do you want the marker to appear on the map so the user knows the “centre” ? In the past I have done this my overlaying an image in the middle of the map.
The fiji thing I think we have seen before, and I think it was Australia too. The longitude gets set to -180.
I’m trying to calculate distance from a saved business address to the users current location for display purposed and for sorting of a list purposes. quick question: If I checked my debugger and the current geographical position IS EMPTY… what should I check or how do I resolve this? The business address longitude and latitude ARE populating, but just the current position is empty. Obviously I’ve allowed the app to access my location when prompted. Any help is much appreciated!
Jason
(In response to: Have you checked what the current Geographic Position in that case actually returns? For example by displaying it in a text field, or checking it in the debugger. It might get you closer to a solution if you know if it’s the wrong coordinates, if it’s empty, etc.
Also you could try saving the first instance of Current […] in a state, and fetch it from there instead. If there’s a bug in the map element, you might be able to circumvent it that way.)