Geolocation: Google Maps

Developed or developing a new product in PureBasic? Tell the world about it.
Little_man
Enthusiast
Enthusiast
Posts: 128
Joined: Fri Mar 29, 2013 4:55 pm
Location: The Netherland

Re: Geolocation: Google Maps

Post by Little_man »

JHPJHP,

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

Little_man
User avatar
JHPJHP
Addict
Addict
Posts: 1847
Joined: Sat Oct 09, 2010 3:47 am
Contact:

Geolocation: Google Maps

Post 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.
Last edited by JHPJHP on Fri Jun 21, 2019 5:27 pm, edited 1 time in total.

STATUS: Mostly Unavailable :: Downloads moved to My PureBasic Stuff; free executables, access key required for source code.
_________________
Little_man
Enthusiast
Enthusiast
Posts: 128
Joined: Fri Mar 29, 2013 4:55 pm
Location: The Netherland

Re: Geolocation: Google Maps

Post 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
User avatar
Kiffi
Addict
Addict
Posts: 1206
Joined: Tue Mar 02, 2004 1:20 pm
Location: Amphibios 9

Re: Geolocation: Google Maps

Post 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
Hygge
User avatar
JHPJHP
Addict
Addict
Posts: 1847
Joined: Sat Oct 09, 2010 3:47 am
Contact:

Re: Geolocation: Google Maps

Post 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().
Last edited by JHPJHP on Mon Jun 24, 2019 3:06 am, edited 2 times in total.

STATUS: Mostly Unavailable :: Downloads moved to My PureBasic Stuff; free executables, access key required for source code.
_________________
Little_man
Enthusiast
Enthusiast
Posts: 128
Joined: Fri Mar 29, 2013 4:55 pm
Location: The Netherland

Re: Geolocation: Google Maps

Post by Little_man »

JHPJHP

Problem has been resolved.

Little_man
User avatar
JHPJHP
Addict
Addict
Posts: 1847
Joined: Sat Oct 09, 2010 3:47 am
Contact:

Re: Geolocation: Google Maps

Post 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).

STATUS: Mostly Unavailable :: Downloads moved to My PureBasic Stuff; free executables, access key required for source code.
_________________
User avatar
JHPJHP
Addict
Addict
Posts: 1847
Joined: Sat Oct 09, 2010 3:47 am
Contact:

Re: Geolocation: Google Maps

Post 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

STATUS: Mostly Unavailable :: Downloads moved to My PureBasic Stuff; free executables, access key required for source code.
_________________
User avatar
JHPJHP
Addict
Addict
Posts: 1847
Joined: Sat Oct 09, 2010 3:47 am
Contact:

Geolocation: Google Maps

Post by JHPJHP »

Updated:
- fixed Geolocation_IP_Address.pb

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

STATUS: Mostly Unavailable :: Downloads moved to My PureBasic Stuff; free executables, access key required for source code.
_________________
User avatar
JHPJHP
Addict
Addict
Posts: 1847
Joined: Sat Oct 09, 2010 3:47 am
Contact:

Re: Geolocation: Google Maps

Post 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.
Last edited by JHPJHP on Mon Aug 09, 2021 1:28 am, edited 1 time in total.

STATUS: Mostly Unavailable :: Downloads moved to My PureBasic Stuff; free executables, access key required for source code.
_________________
User avatar
JHPJHP
Addict
Addict
Posts: 1847
Joined: Sat Oct 09, 2010 3:47 am
Contact:

Re: Geolocation: Google Maps

Post by JHPJHP »

Updated (Windows package):
- some minor improvements
- squashed a couple bugs

Most changes were to the Split View examples.

NB*: Geolocation: Google Maps free executables were also updated.

STATUS: Mostly Unavailable :: Downloads moved to My PureBasic Stuff; free executables, access key required for source code.
_________________
User avatar
JHPJHP
Addict
Addict
Posts: 1847
Joined: Sat Oct 09, 2010 3:47 am
Contact:

Re: Geolocation: Google Maps

Post 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.

NB*: Geolocation: Google Maps free executables were also updated.

Image

STATUS: Mostly Unavailable :: Downloads moved to My PureBasic Stuff; free executables, access key required for source code.
_________________
User avatar
JHPJHP
Addict
Addict
Posts: 1847
Joined: Sat Oct 09, 2010 3:47 am
Contact:

Re: Geolocation: Google Maps

Post by JHPJHP »

Updated (Windows only):
- added User Agent to bypass Google API warning
- full screen control window lock transparency changed from double-click to right-click

STATUS: Mostly Unavailable :: Downloads moved to My PureBasic Stuff; free executables, access key required for source code.
_________________
Post Reply