It is currently Fri Nov 15, 2019 4:24 am

All times are UTC + 1 hour




Post new topic Reply to topic  [ 68 posts ]  Go to page 1, 2, 3, 4, 5  Next
Author Message
 Post subject: Geolocation: Google Maps
PostPosted: Thu Sep 15, 2016 12:36 am 
Offline
Addict
Addict
User avatar

Joined: Sat Oct 09, 2010 3:47 am
Posts: 1592
-----------------------------------------------------------------------------------

Download Geolocation: Google Maps from My PureBasic Stuff

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

Tricks 'n' Tips
PureBasic Interface to OpenCV
PureBasic Interface to WinDivert
PureBasic Interface to WinRAR
PureBasic Interface to 7-Zip
PureBasic Interface to ImDisk
Windows Services & Other Stuff
Invading Space Aliens
Death Star vs Asteroids
GIF Toolkit
LSB File Embedding
Spider Web Drawing
Deform Image: MLS
Video Snipping Tool
Stitch Images: SIFT
Image Waves: LUT
YouTube Player & Downloader
MP4 Player & Downloader
Barcode Generator
Embed JS into PureBasic
Geolocation: Google Maps
Book & Viewer & Magnify
Video for Windows: VfW
Alternate Console
Network Share Management

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

Registry is temporarily modified to access HTML5: FEATURE_BROWSER_EMULATION.

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

Google Maps - GET A KEY :: Google Maps API :: IP-API
- Geolocation_Directions.pb / Geolocation_Directions_OSX.pb (geolocation_directions.pbi)
-- show / hide directions panel
-- show directions between two locations (draggable Markers)
-- Travel Mode options (Driving, Walking, Bicycling, Transit)
- Geolocation_IP_Address.pb / Geolocation_IP_Address_OSX.pb (geolocation_ip_address.pbi)
-- execute a Geolocation by IP4 address or URL (root address)
-- Default Zoom option
-- geolocate your current IP address
- Geolocation_Side_by_Side.pb / Geolocation_Side_by_Side_OSX.pb (geolocation_side_by_side.pbi)
-- display a map location beside the same Street View location
-- Default Zoom option
- Geolocation_Two_Points.pb / Geolocation_Two_Points_OSX.pb (geolocation_two_points.pbi)
-- map the distance between two locations
-- Default Zoom option

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

The following links show the Debugged output for each example, saved as JPG files:

Geolocation_Directions.pb: Display a red and green Marker.
- hovering over the Marker should show a tooltip containing the location names
- Left-Mouse-Click the Marker should show an Info-Window with additional information

Geolocation_IP_Address.pb: Display a bouncing red marker inside a blue transparent circle.
- hovering over the Marker should show a tooltip containing the locations IP address
- Left-Mouse-Click the Marker should show an Info-Window with additional information

Geolocation_Side_by_Side.pb: Display a map location beside the Street View of the same location.
- drag the golden emoji on the map side to a new location
- click the size icon on the Street View side to toggle full-screen

Geolocation_Two_Points.pb: Display a red and green Marker.
- hovering over the Marker should show a tooltip containing the location names
- Left-Mouse-Click the Marker should show an Info-Window with additional information

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

Quick method to geocode an address formatted to XML posted by Mijikai.
Code:
InitNetwork()
Debug PeekS(ReceiveHTTPMemory("https://maps.google.com/maps/api/geocode/xml?sensor=false&address=Toronto+ON+CA&key=XXXXXXXXXX"), -1, #PB_UTF8)

Quick method to return directions formatted to JSON.
Code:
InitNetwork()
Debug PeekS(ReceiveHTTPMemory("https://maps.google.com/maps/api/directions/json?origin=Toronto&destination=Mount+Rushmore&key=XXXXXXXXXX"), -1, #PB_UTF8)

_________________

I will be unreachable from the forum for an indefinite period; downloads moved to My PureBasic Stuff.
_________________


Last edited by JHPJHP on Fri Oct 11, 2019 1:14 am, edited 96 times in total.

Top
 Profile  
Reply with quote  
 Post subject: Re: Geolocation VIA WebGadget
PostPosted: Thu Sep 15, 2016 6:39 am 
Offline
PureBasic Bullfrog
PureBasic Bullfrog
User avatar

Joined: Wed Jul 06, 2005 5:42 am
Posts: 8006
Location: Fort Nelson, BC, Canada
Works well here, gets everything right.

_________________
Veni, vidi, vici.


Top
 Profile  
Reply with quote  
 Post subject: Re: Geolocation VIA WebGadget
PostPosted: Thu Sep 15, 2016 7:10 am 
Offline
Addict
Addict
User avatar

Joined: Sat Oct 09, 2010 3:47 am
Posts: 1592
Hi netmaestro,

Thank you for testing the example and leaving a comment.

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

I noticed the ValidateData Procedure had a problem with one of the Regular Expression patterns, resulting in some IP address' incorrectly being tagged as invalid.

Updated:
- fixed Regular Expression pattern
- added additional Marker information

_________________

I will be unreachable from the forum for an indefinite period; downloads moved to My PureBasic Stuff.
_________________


Last edited by JHPJHP on Sat Sep 17, 2016 3:43 am, edited 1 time in total.

Top
 Profile  
Reply with quote  
 Post subject: Re: Geolocation VIA WebGadget
PostPosted: Thu Sep 15, 2016 10:13 am 
Offline
Enthusiast
Enthusiast

Joined: Fri Oct 16, 2009 10:12 am
Posts: 602
Location: BE
Works here too with my IP adress, but how to add another adres (url or IP) and get that blue connection-line like above ?

Thanks.

_________________
Yeah I know, but keep in mind ... Leonardo da Vinci was also an autodidact.


Top
 Profile  
Reply with quote  
 Post subject: Re: Geolocation VIA WebGadget
PostPosted: Thu Sep 15, 2016 5:24 pm 
Offline
Addict
Addict
User avatar

Joined: Sat Oct 09, 2010 3:47 am
Posts: 1592
Hi Joris,

The image was misleading, so I replaced it with a more accurate visual representation of the example. This is not to say the "blue connection-line" feature you mentioned could not be included, but the current example was built static to uniquely showcase a single Geolocation.

On a similar note, multiple Markers can be added to a map with only a few changes to the SetScript Procedure:
- add additional array values: "['" + MarkerText + "'," + Longitude + "," + Latitude + "]"
Code:
GeolocationData.s = #TAB$ + #TAB$ + #TAB$ + "var locations=[" + #LF$ +
                    #TAB$ + #TAB$ + #TAB$ + #TAB$ + "['" + MarkerText + "'," + Longitude + "," + Latitude + "]" + #LF$ +
                    #TAB$ + #TAB$ + #TAB$ + "];" + #LF$

_________________

I will be unreachable from the forum for an indefinite period; downloads moved to My PureBasic Stuff.
_________________


Last edited by JHPJHP on Fri Sep 16, 2016 6:41 pm, edited 3 times in total.

Top
 Profile  
Reply with quote  
 Post subject: Re: Geolocation VIA WebGadget
PostPosted: Thu Sep 15, 2016 10:51 pm 
Offline
Addict
Addict
User avatar

Joined: Sat Oct 09, 2010 3:47 am
Posts: 1592
Updated:
- added a Default Zoom option
- various cosmetic changes

NB*: Depending on the location a high numbered zoom might best be viewed in Satellite mode.

_________________

I will be unreachable from the forum for an indefinite period; downloads moved to My PureBasic Stuff.
_________________


Last edited by JHPJHP on Tue Sep 20, 2016 2:43 am, edited 3 times in total.

Top
 Profile  
Reply with quote  
 Post subject: Re: Geolocation VIA WebGadget
PostPosted: Fri Sep 16, 2016 9:17 am 
Offline
Addict
Addict
User avatar

Joined: Sat Oct 09, 2010 3:47 am
Posts: 1592
Updated:
- added 1 example: Geolocation_TwoPoints.pb (geolocation_twopoints.pbi)

NB*: This example maps the distance between two locations; click the Marker to view information.

_________________

I will be unreachable from the forum for an indefinite period; downloads moved to My PureBasic Stuff.
_________________


Last edited by JHPJHP on Fri Sep 16, 2016 6:38 pm, edited 2 times in total.

Top
 Profile  
Reply with quote  
 Post subject: Re: Geolocation VIA WebGadget
PostPosted: Fri Sep 16, 2016 10:15 am 
Offline
Moderator
Moderator
User avatar

Joined: Sat Apr 26, 2003 1:11 am
Posts: 1390
great stuff, thx for sharing !!!!

_________________
SPAMINATOR NR.1


Top
 Profile  
Reply with quote  
 Post subject: Re: Geolocation VIA WebGadget
PostPosted: Fri Sep 16, 2016 6:30 pm 
Offline
Addict
Addict
User avatar

Joined: Sat Oct 09, 2010 3:47 am
Posts: 1592
Hi Rings,

You're most welcome, and thank you for commenting.

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

Updated:
- added custom Markers: Geolocation_TwoPoints.pb
- added Marker animation

_________________

I will be unreachable from the forum for an indefinite period; downloads moved to My PureBasic Stuff.
_________________


Last edited by JHPJHP on Sat Sep 17, 2016 8:37 pm, edited 1 time in total.

Top
 Profile  
Reply with quote  
 Post subject: Re: Geolocation VIA WebGadget
PostPosted: Fri Sep 16, 2016 9:09 pm 
Offline
Addict
Addict
User avatar

Joined: Sat Oct 09, 2010 3:47 am
Posts: 1592
Updated:
- added 1 example: Geolocation_Directions.pb (geolocation_directions.pbi)

NB*: This example shows directions between two locations (various Travel Modes); includes draggable Markers.

_________________

I will be unreachable from the forum for an indefinite period; downloads moved to My PureBasic Stuff.
_________________


Last edited by JHPJHP on Sat Sep 17, 2016 5:48 pm, edited 1 time in total.

Top
 Profile  
Reply with quote  
 Post subject: Re: Geolocation VIA WebGadget
PostPosted: Sat Sep 17, 2016 12:33 am 
Offline
User
User

Joined: Wed May 13, 2009 8:38 am
Posts: 84
Location: Arizona, USA
Very Nice! Thank You for sharing.


Top
 Profile  
Reply with quote  
 Post subject: Re: Geolocation via WebGadget
PostPosted: Sun Sep 18, 2016 2:47 am 
Offline
Addict
Addict
User avatar

Joined: Sat Oct 09, 2010 3:47 am
Posts: 1592
Hi GoodNPlenty,

You're welcome, thank you for commenting.

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

Updated:
- corrected latitude / longitude order
- added a Marker circle: Geolocation.pb
- changed units from miles to kilometers: Geolocation_Directions.pb
- changed Marker distance from meters to kilometers: Geolocation_TwoPoints.pb
- added location and elevation data to the Marker popup window: Geolocation_TwoPoints.pb

_________________

I will be unreachable from the forum for an indefinite period; downloads moved to My PureBasic Stuff.
_________________


Top
 Profile  
Reply with quote  
 Post subject: Re: Geolocation via WebGadget
PostPosted: Tue Sep 20, 2016 2:42 am 
Offline
Addict
Addict
User avatar

Joined: Sat Oct 09, 2010 3:47 am
Posts: 1592
Updated:
- added 2 OSX examples (modified from the Windows examples)
-- Geolocation_Directions_OSX.pb
--- show directions between two locations (draggable Markers)
--- Travel Mode options (Driving, Walking, Bicycling, Transit)
-- Geolocation_TwoPoints_OSX.pb
--- map the distance between two locations
--- Default Zoom option

_________________

I will be unreachable from the forum for an indefinite period; downloads moved to My PureBasic Stuff.
_________________


Top
 Profile  
Reply with quote  
 Post subject: Re: Geolocation via WebGadget
PostPosted: Wed Sep 21, 2016 3:01 pm 
Offline
Addict
Addict
User avatar

Joined: Sat Oct 09, 2010 3:47 am
Posts: 1592
Updated:
- added 1 OSX example (modified from the Windows example)
-- Geolocation_OSX.pb
--- execute a Geolocation by IP4 address or URL (root address)
--- Default Zoom option
--- geolocate your current IP address

The following two posts were helpful in getting the OSX examples working:
- [ wilbert ] :: http://www.purebasic.fr/english/viewtopic.php?p=494430#p494430
- [ rodego ] :: http://purebasic.fr/english/viewtopic.php?p=343542#p343542

Image

_________________

I will be unreachable from the forum for an indefinite period; downloads moved to My PureBasic Stuff.
_________________


Top
 Profile  
Reply with quote  
 Post subject: Re: Geolocation via WebGadget
PostPosted: Sat Sep 24, 2016 10:36 am 
Offline
User
User
User avatar

Joined: Wed Mar 15, 2006 9:40 am
Posts: 98
Location: Germany
Thank You for sharing.
But in Geolocation_Directions and Geolocation I see only the Toolbar. The rest keeps white.
Tested with Win7 x64 and PB 5.42 and 5.50 as x86 and x64. There are no error messages.
Any hints?

_________________
Please pardon my English, my native tongue is German.


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 68 posts ]  Go to page 1, 2, 3, 4, 5  Next

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 5 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  

 


Powered by phpBB © 2008 phpBB Group
subSilver+ theme by Canver Software, sponsor Sanal Modifiye