Page 5 of 5

Re: Geolocation: Google Maps

Posted: Fri Jun 21, 2019 6:51 am
by Little_man
JHPJHP,

A location with a ' gives an error (sample: 't hofke 1, Eindhoven)

Little_man

Geolocation: Google Maps

Posted: Fri Jun 21, 2019 8:25 am
by JHPJHP
Hi Little_man,

Thank you for posting your results.
Little_man wrote:A location with a ' gives an error (sample: 't hofke 1, Eindhoven)
That issue should have been fixed a few versions back, including numerous minor improvements and bug fixes.

Just in case, I recompiled the latest Windows examples; direct download available from my website.

Re: Geolocation: Google Maps

Posted: Fri Jun 21, 2019 3:03 pm
by Little_man
JHPJHP,

Start location: t Hofke 1, eindhoven, programma gives location: 't Hofke 30, 5641 AH Eindhoven, Nederland (this is correct zipcode).
End location: eindhoven, Nederland, programma gives: Eindhoven, Nederland.

Pushing the green arrow, information will be saved in database.
Then double click in the database that shows the SplashWindow and after a while I get a black window

Little_man

Re: Geolocation: Google Maps

Posted: Fri Jun 21, 2019 3:35 pm
by Kiffi
Little_man wrote:Pushing the green arrow, information will be saved in database.
This looks like a typical insert problem in connection with string concatenation.

myValue = "'t Hofke"

"INSERT INTO myTable (myColumn) VALUES ('" + myValue + "')"

Solution: Try doubling the apostrophe before the insert.

myValue = "'t Hofke"
myValue = ReplaceString(myValue, "'", "''")

(I hope you can recognize the fat red apostrophes.)

Greetings ... Peter

Re: Geolocation: Google Maps

Posted: Fri Jun 21, 2019 5:10 pm
by JHPJHP
Hi Little_man

The problem stems from Google Maps handling of some address' through some of its services.

Translating the address to latitude / longitude using an alternate Google Maps service seems to have fixed the problem.
- geolocation_autocomplete.pbi and geolocation_directions.pbi have been updated

Please test the updated examples to confirm that the problem has been resolved.

------------------------------------------------------

Hi Kiffi,

Thank you for your post.
Kiffi wrote:Solution: Try doubling the apostrophe before the insert.
Doubling a single-quote for SQL statements has already been written into the code; see Procedure DatabaseSetRow().

Re: Geolocation: Google Maps

Posted: Sat Jun 22, 2019 7:35 am
by Little_man
JHPJHP

Problem has been resolved.

Little_man

Re: Geolocation: Google Maps

Posted: Sun Jun 23, 2019 12:22 pm
by JHPJHP
Updated (Windows):
- added a language window
- added map styles
- couple minor improvements

Language Window
Selecting a language will close the window, reloading the current map in that language.
No database record is created until the current map is refreshed or a new map is retrieved.

Map Styles
Multiple JSON files can be associated to each example.
MapType name is taken from the JSON file name.
- text between string symbols (eg. \styles\geolocation_two_points$Retro$.json)

Map styles can be created from the following link: https://mapstyle.withgoogle.com/
Here is a site with over 1500 preconfigured map styles: https://snazzymaps.com/

NOTE
After upgrading to PureBasic 5.71 beta 2 LTS, the full screen Procedure needed modifying due to some aspect ratio issues.
Earlier versions of PureBasic may experience problems in full screen mode due to the recent changes (untested).

Re: Geolocation: Google Maps

Posted: Thu Jun 27, 2019 6:48 am
by JHPJHP
Updated (Windows):
- couple minor improvements
- couple bug fixes

Minor Improvements
Geolocation_Directions.pb:
- modified the directions algorithm
- added the option to remove the markers (Location List)
- added the option to change the line color (Location List)
- Saving the map will temporarily hide the map controls
Geolocation_IP_Address.pb:
- added the option to change the circle color (Location List)
- Saving the map will temporarily hide the map controls
Geolocation_Split_View.pb:
- various changes to improve the user experience
- Saving the map will temporarily hide the map controls
Geolocation_Two_Points.pb:
- added the option to change the line color (Location List)
- Saving the map will temporarily hide the map controls

Geolocation: Google Maps

Posted: Tue Dec 03, 2019 4:45 pm
by JHPJHP
Updated:
- fixed Geolocation_IP_Address.pb

Geolocation_IP_Address.pb
There was a format change to the IP-API XML download.

Re: Geolocation: Google Maps

Posted: Sun May 09, 2021 2:29 am
by JHPJHP
Updated:
- improved various parts of the code
- renamed some include files

Most of the updates were to the example Geolocation_Split_View.pb.
- updated version renamed to Geolocation_Split_View_1.pb
- original version renamed to Geolocation_Split_View_2.pb

While the Autocomplete "window" in the old version drew focus away from the main window, in the new version it acts more like a PureBasic Gadget.

NB*: Only the Windows package was updated.

Re: Geolocation: Google Maps

Posted: Sat Aug 07, 2021 7:37 pm
by JHPJHP
Updated (Windows package):
- some minor improvements
- squashed a couple bugs

Most changes were to the Split View examples.

Re: Geolocation: Google Maps

Posted: Tue Aug 10, 2021 8:41 pm
by JHPJHP
Updated (Windows package):
- added Prediction option to Split View example
- removed second Split View example
- various other improvements

Google Prediction Service
Previously the use of the Google Prediction Service was not optional, but I noticed with some locations (i.e. The Great Pyramid) a street address was returned instead of the actual request. The user now has the option to use or not use the Google Prediction Service for improved results.

Re: Geolocation: Google Maps

Posted: Mon Nov 15, 2021 4:09 pm
by JHPJHP
Updated (Windows only):
- added User Agent to bypass Google API warning
- control window (lock) transparency changed from double-click to right-click

-----------------------

Modified the User Agent
Fixing one problem seemed to have caused another... some Google Maps API stuff stopped working.
I thought I was being clever selecting a Chrome User Agent; using an Edge User Agent fixed the problem.

NB*: Google Translate Service was also updated for consistency.

Re: Geolocation: Google Maps

Posted: Thu Feb 03, 2022 5:36 pm
by JHPJHP
Updated (Windows only):
- modified Geolocation_Two_Points.pb
- couple minor improvements

Geolocation_Two_Points.pb
Previous method for adding custom markers was depreciated, and the marker URL was no longer valid.

Re: Geolocation: Google Maps

Posted: Fri Mar 17, 2023 10:04 pm
by JHPJHP
Updated:
- modified User Agent for better compatibility

Weird Behavior
For the previous few weeks, I tested Geolocation: Google Maps, but they were not working, I assumed it had to do with Microsoft permanently disabling Internet Explorer 11 on February 14, 2023.

I tried again today and "lo and behold" things were working again, but I did notice a problem with map animations. After testing various User Agent's I settled on one that provided better support for not only Google Maps, but also my YouTube Player & Downloader, which has also been updated.

NB*: Free executables (x86/x64) were updated and can be downloaded from My PureBasic Stuff; see FREE STUFF.

Image Image
Image Image