Page 2 of 2
Posted: Tue Jun 09, 2009 11:33 am
by Michael Vogel
blueznl wrote:Ah, ok. Now I understand

I should have added the link already in the previous posting
When you play around with the code, just tell me, if you like it (or find some issues :roll:)
The actual
Forerunner program demonstrate the usage of google maps, but you have to do the following steps to see a result:
• store the forerunner program to a directory and create a subdirectory 'Maps'
• download an
example file or use your own sport tracks
• start the
forerunner
• press 'o' for options to select google maps and satellite view
• press 'h' to load the history file
• select the sport track and press 'enter'
Michael

Posted: Mon Jun 15, 2009 10:38 am
by dige
ForeRunner.exe crashes while start fullscreen view.. there are no further informations...
Tried the provided Aschenbahn example..
Posted: Sat Jul 18, 2009 3:38 pm
by Michael Vogel
dige wrote:ForeRunner.exe crashes while start fullscreen view.. there are no further informations...
Tried the provided Aschenbahn example..
Thanks for this information, beside the Intel G965 chipset there seem to be another graphic card which crashes when DirectX7 3D graphic commands are used.
Maybe the
actual version will work already, maybe you can check it once more. Otherwise, the
DirectX9 version will work (hopefully

)...
If not, I would ask you to tell me which graphic card you are using, I would add a filter that no 3D graphic is used with this card in the DirectX7 version.
Thanks,
Michael
PS there is one open issue, which could cause problems (but only if you use more tracks and change between them very fast)...
CreateSprite() seems to fail in around 1 of 500 calls
I know, there won't be a solution for that, but I want to warn others to be careful using it :roll:...
Code: Select all
LockMutex(ThreadMutex)
If CreateSprite(#GoogleMapBitmap,MapX,MapY,#PB_Sprite_Texture)
StartDrawing(SpriteOutput(#GoogleMapBitmap))
DrawImage(ImageID(#GoogleMapBitmap),0,0)
StopDrawing()
TransparentSpriteColor(#GoogleMapBitmap,#TransparentColor)
CreateSprite3D(#GoogleMapSprite,#GoogleMapBitmap)
GoogleMapLoaded=#True
SendMessage_(win,#WM_COMMAND,#MAP_UPDATE,0)
Else
Debug "CreateSprite() fehlgeschlagen..."
EndIf
UnlockMutex(ThreadMutex)
Re: Google Maps
Posted: Thu Feb 04, 2010 8:59 am
by Michael Vogel
Just two comments to my google maps projects:
• the
Forerunner program (see above) is 99% complete - all sprite problems have been fixed, only the well-known DX9-Vista+ compatibility issues are left
• the
Map Fixer creates custom maps for GPS devices -- is working already, but (hopefully) will get some enhancements in the future...
...one thing I want to implement is to open a window by PB which show google maps and allows to get the coordinates from a location into the running PB program. Has anyone has done something like this already?
Michael
Re: Google Maps
Posted: Fri Feb 05, 2010 9:26 am
by Michael Vogel
Maybe someone needs to get geo coordinates from an named address, here's the code to do so (the replacestring section should be optimized, anything else should work fine for everyone

)...
Have fun,
Michael
Code: Select all
Procedure.s GetWebPage(URL.s)
Global Proxy.s
#GoogleMapsDataLength=256
#INTERNET_FLAG_RELOAD=$80000000
#INTERNET_OPTION_SECURITY_FLAGS=31
#SECURITY_FLAG_IGNORE_UNKNOWN_CA=$100
#INTERNET_OPEN_TYPE_PRECONFIG=0; use registry configuration
#INTERNET_OPEN_TYPE_DIRECT=1; direct to net
#INTERNET_OPEN_TYPE_PROXY=3; via named proxy
#INTERNET_OPEN_TYPE_PRECONFIG_WITH_NO_AUTOPROXY=4; prevent using java/script/INS
Protected HandleInet.l
Protected HandleURL.l
Protected Flags.l
Protected FlagLen.l
Protected Bytes.l=0
Protected Html.s=Space(#GoogleMapsDataLength)
If Len(Proxy)
HandleInet=InternetOpen_("Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)",#INTERNET_OPEN_TYPE_PRECONFIG,#Null,#Null,0)
Else
HandleInet=InternetOpen_("InetURL/1.0",#INTERNET_OPEN_TYPE_PROXY, Proxy,#Null,0)
EndIf
If HandleInet
Flags=0
FlagLen=SizeOf(Flags)
InternetQueryOption_(HandleInet,#INTERNET_OPTION_SECURITY_FLAGS,@Flags,@FlagLen)
Flags=Flags|#SECURITY_FLAG_IGNORE_UNKNOWN_CA
InternetSetOption_(HandleInet,#INTERNET_OPTION_SECURITY_FLAGS,@Flags,SizeOf(Flags))
HandleURL=InternetOpenUrl_(HandleInet,URL,#Null,0,#INTERNET_FLAG_RELOAD,0)
If HandleURL
If InternetReadFile_(HandleURL,@Html,Len(Html),@Bytes)
InternetCloseHandle_(HandleURL)
ProcedureReturn Trim(HTML)
Else
; ProcedureReturn "Failed InternetReadFile"
EndIf
Else
InternetCloseHandle_(HandleInet)
; ProcedureReturn "Failed InternetOpenUrl"
EndIf
InternetCloseHandle_(HandleInet)
Else
; ProcedureReturn "Failed InternetOpen"
EndIf
; ProcedureReturn "Failed Everything"
ProcedureReturn ""
EndProcedure
Procedure.i GoogleMapsCheck(address.s)
; THREAD;
Protected Text.s
Protected URL.s
Protected Result.s
Protected n.l
Protected lat.d
Protected lon.d
Text=address
URL=LCase(text)
URL=ReplaceString(URL,"ä","ae")
URL=ReplaceString(URL,"ö","oe")
URL=ReplaceString(URL,"ü","ue")
URL=ReplaceString(URL,"ß","ss")
URL=ReplaceString(URL," ","%20")
URL="http://maps.google.com/maps/geo?q="+URL+"&output=csv&key=<API_KEY>"
Debug ""
Debug URL
Debug "---"
Result=GetWebPage(URL)
If Len(Result)=0
Debug "Could not access Google Maps :-("
Else
n=Val(StringField(Result,1,","))
If n=200
n=Val(StringField(Result,2,","))
lat=ValD(StringField(Result,3,","))
lon=ValD(StringField(Result,4,","))
Debug "Coordinates for '"+Text+"' received with "+StringField("low|moderate|good|high|excellent",n>>1+1,"|")+" accuracy :-)"
Debug lat
Debug lon
Else
Debug "Could not find coordinates for '"+Text+"' :-("
EndIf
EndIf
EndProcedure
GoogleMapsCheck("Kärnterstraße 1,Vienna,Austria")
GoogleMapsCheck("Paris")
GoogleMapsCheck("Eiffeltower")
GoogleMapsCheck("Louvre")
GoogleMapsCheck("London")
GoogleMapsCheck("Tower Bridge"); oops
GoogleMapsCheck("Tower Bridge,London")