Geolocation: Google Maps

Developed or developing a new product in PureBasic? Tell the world about it.
uweb
User
User
Posts: 98
Joined: Wed Mar 15, 2006 9:40 am
Location: Germany

Re: Geolocation via WebGadget

Post by uweb »

Hi JHPJHP,

it is the same like bevor.
I have no problem to try other ways. I like to make it run too.

googleapis.com is working nearly complete.
Only the images for the control elements over the map are missing, the element left bottom do not work and
if I keep left mouse-button down on the upper right element the cursur change to a cross-arrow after move and it marks all streets in france (not in germany - my IP-address routes to the same as 87.173.66.100).
I did try some things, but it is always the same.

And now it becomes crazy:
After this i have tried it in VB VM's. Under Win7 x64 and Win10 x64 the map works fine. But the button in toolbar have no images.
Please pardon my English, my native tongue is German.
JHPJHP
Addict
Addict
Posts: 2129
Joined: Sat Oct 09, 2010 3:47 am
Contact:

Re: Geolocation via WebGadget

Post by JHPJHP »

Hi uweb,

If you haven't already done so, please download the latest version of Geolocation via WebGadget.

If you're still seeing a problem you may have a setting, firewall, etc. affecting the output.
Last edited by JHPJHP on Tue Sep 27, 2016 11:30 am, edited 6 times in total.
User avatar
Andre
PureBasic Team
PureBasic Team
Posts: 2056
Joined: Fri Apr 25, 2003 6:14 pm
Location: Germany (Saxony, Deutscheinsiedel)
Contact:

Re: Geolocation via WebGadget

Post by Andre »

Very well done, thank you very much for this nice piece of code! :mrgreen:

(Works without any problems for me on Win10 x64, on MacOS not tested yet...)
Bye,
...André
(PureBasicTeam::Docs & Support - PureArea.net | Order:: PureBasic | PureVisionXP)
JHPJHP
Addict
Addict
Posts: 2129
Joined: Sat Oct 09, 2010 3:47 am
Contact:

Re: Geolocation via WebGadget

Post by JHPJHP »

Hi Andre,

You are most welcome.

Thank you for reporting your results.
uweb
User
User
Posts: 98
Joined: Wed Mar 15, 2006 9:40 am
Location: Germany

Re: Geolocation via WebGadget

Post by uweb »

Hi JHPJHP,

http://www.webformation.de/Geolocation/ ... on_001.PNG
Geolocation.pb: Do not show a bouncing red marker, but the blue transparent circle.
- hovering over the Marker show a tooltip containing the locations IP address
- Left-Mouse-Click the Marker show an Info-Window with additional information. The [x] inside it works, but is invisible.
Now I see : I have the same problem in the PB-IDE at one point.

http://www.webformation.de/Geolocation/ ... on_002.PNG
Geolocation_Directions.pb: Show a red and green Marker.
- hovering over the Marker do not show a tooltip containing the location names
- Left-Mouse-Click the Marker should show an Info-Window with additional information
- Left-Mouse-Click the Marker show an Info-Window with additional information. The [x] inside it works, but is invisible.

http://www.webformation.de/Geolocation/ ... on_003.PNG
Geolocation_TwoPoints.pb: Do not show a red and green Marker and there is no funktion with (not nonly invisible).

The firewall sounds like a good idea. But inside the VirualBox Virtual Mashines (on the same PC) the map works. There are missing images in the toolbar.
I will check it anyway.
Thank you.
Please pardon my English, my native tongue is German.
JHPJHP
Addict
Addict
Posts: 2129
Joined: Sat Oct 09, 2010 3:47 am
Contact:

Re: Geolocation via WebGadget

Post by JHPJHP »

Hi uweb,

Thank you for the additional information.

Either replace the top part of geolocation.pbi with the following, or download the latest version of Geolocation via WebGadget:
- other content options: IE=9 :: IE=11 :: IE=EmulateIE9 :: IE=EmulateIE11

Code: Select all

Geolocation = "<!DOCTYPE html>" + #LF$ +
              "<html lang='en'>" + #LF$ +
              #TAB$ + "<head>" + #LF$ +
              #TAB$ + #TAB$ + "<meta http-equiv='content-type' content='text/html; charset=utf-8'>" + #LF$ +
              #TAB$ + #TAB$ + "<meta http-equiv='X-UA-Compatible' content='IE=edge'/>" + #LF$ +
              #TAB$ + #TAB$ + "<meta name='viewport' content='width=device-width, initial-scale=1'>" + #LF$ +
              #TAB$ + #TAB$ + "<title>IP-API / Google Maps: Geolocation</title>" + #LF$ +
If you're still having issues, try changing the following setting from the IE menu:
- Tools -- Compatibility View settings -- Display intranet sites in Compatibility View: Unchecked
uweb
User
User
Posts: 98
Joined: Wed Mar 15, 2006 9:40 am
Location: Germany

Re: Geolocation via WebGadget

Post by uweb »

Hi JHPJHP,

with this it is still have the same.
But I have tried different because it is more and more clear that i have a problem with my system.
I use it since three years, have tested a lot of things and did only use CCleaner. My VM's are very new and clean.

Instead of compiling normal and test in the VM I did compile now in the VM.
The resulting Exe works in the VM without any problems.
In my normal system I have still the same problems plus the missing toolbar-images with this Exe.

Thank you very much and sorry for the lot of needless work.
It realy looks like it was only my system.
Please pardon my English, my native tongue is German.
JHPJHP
Addict
Addict
Posts: 2129
Joined: Sat Oct 09, 2010 3:47 am
Contact:

Re: Geolocation via WebGadget

Post by JHPJHP »

Hi uweb,
uweb wrote:It realy looks like it was only my system.
No Problem, thank you for the confirmation.

I've updated Geolocation via WebGadget, returning the include files to their original state.
Last edited by JHPJHP on Thu Jan 26, 2017 6:06 pm, edited 1 time in total.
Little_man
Enthusiast
Enthusiast
Posts: 143
Joined: Fri Mar 29, 2013 4:55 pm
Location: The Netherland

Re: Geolocation via WebGadget

Post by Little_man »

Hi JHPJHP,

Is it possible to take out directions (right side)?

Little_man
JHPJHP
Addict
Addict
Posts: 2129
Joined: Sat Oct 09, 2010 3:47 am
Contact:

Re: Geolocation via WebGadget

Post by JHPJHP »

Hi Little_man,

The easiest way would be to set the Panel DIV style to none.

I've updated Geolocation via WebGadget to include a CheckBoxGadget to demonstrate this.

NB*: With some simple JavaScript the DIV Panel could be made to slide in and out of view.
Little_man
Enthusiast
Enthusiast
Posts: 143
Joined: Fri Mar 29, 2013 4:55 pm
Location: The Netherland

Re: Geolocation via WebGadget

Post by Little_man »

Hi JHPJHP,

Is it possible to take out directions (right side)? --> Thanks for the solution (CheckBoxGadget).
And it is possible to store this information in a file?

Little_man
JHPJHP
Addict
Addict
Posts: 2129
Joined: Sat Oct 09, 2010 3:47 am
Contact:

Re: Geolocation via WebGadget

Post by JHPJHP »

Hi Little_man,

Using a modified version of the quick method from the first post, directions can be returned in either an XML or JSON format:

Code: Select all

InitNetwork()
Debug PeekS(ReceiveHTTPMemory("http://maps.google.com/maps/api/directions/xml?origin=Toronto&destination=Mount+Rushmore"), -1, #PB_UTF8)
NB*: Updated the first post to include the above quick method.
Little_man
Enthusiast
Enthusiast
Posts: 143
Joined: Fri Mar 29, 2013 4:55 pm
Location: The Netherland

Re: Geolocation via WebGadget

Post by Little_man »

Hi JHPJHP,

Thanks for this information.

Little_man
Sooraa
User
User
Posts: 48
Joined: Thu Mar 12, 2015 2:07 pm
Location: Germany

Re: Geolocation via WebGadget

Post by Sooraa »

Hi JHPJHP,

this is wonderful stuff!

Would it not be a good idea to let adresses as an geolocator-input, which have been qualified by Google like in
http://www.purebasic.fr/german/viewtopi ... le#p338276?
JHPJHP
Addict
Addict
Posts: 2129
Joined: Sat Oct 09, 2010 3:47 am
Contact:

Re: Geolocation via WebGadget

Post by JHPJHP »

Hi Sooraa,

Thank you for saying so.

Each of the examples demonstrates a unique feature of Google Maps; returning a geo-location from a formatted address is available in two of the examples: Geolocation_Directions.pb and Geolocation_Two_Points.pb.

The example Geolocation_IP_Address.pb was designed to return a geo-location from a web or IP address, as it's not a native function of Google Maps.

Located in the first post is a Quick Method for returning a geolocation, similar to your reference from the German forum; both were posted by the same author.
- http://www.purebasic.fr/german/viewtopi ... =8&t=29821
- http://www.purebasic.fr/english/viewtop ... 27&t=66616

The examples were meant only as a guide to what can be achieved with very little code using the WebGadget.

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

Updated:
- renamed 2 examples
-- Geolocation.pb to Geolocation_IP_Address.pb
-- Geolocation _TwoPoints.pb to Geolocation_Two_Points.pb
Locked