Page 4 of 6 FirstFirst 123456 LastLast
Results 31 to 40 of 53

Thread: Google Earth for OSX

  1. #31
    Constant Bitrate zapwizard's Avatar
    Join Date
    Aug 2002
    Location
    Austin, TX
    Posts
    149
    I HAVE A SCRIPT!

    Ok, Terraserver didn't work out.
    The program wouldn't pass live GPS data, only the location of the default view.

    The it only took me from 1:00pm to 2:00am to get a working GPS tracking script.

    I had to learn a lot of applescript from scratch.
    Let me tell you it is very weird as far as context and what commands actually do what.

    My only problem is the only GPS program I found that is applescript compatible (GPSNavX) seems to jack up the location by around 10 degree's.
    I tried to compensate, but it changed based on direction.
    It actually displays a different number then all the other GPS programs on the Mac.
    The only thing I could think of is that it's made for nautical GPS.

    I post the script tommorow.
    Although I learned a lot of stuff from different website it doesn't have any ripped code or anything.
    The script does used the PHP generator I linked to earlier, that was hell to get written right also.

    I am going to see if I can access the serial data directly tommorow.
    I also want to work on some cool features, such as having GPS stats in the ballon on GE.
    A few other things to try but I may not get done.
    -Set camera angle distance based on speed. (Moving faster, view further down the road)
    -Plot out your history on a seperate KML file.

  2. #32
    Constant Bitrate zapwizard's Avatar
    Join Date
    Aug 2002
    Location
    Austin, TX
    Posts
    149
    Ok, found out this morning that I had to convert the DD,MM.xx that NavX puts out into decimal coordinates.

    Here is the working script:

    Code:
    --WRITTEN by ZAPWIZARD
    --Requires GPSNavX and XML RPC
    
    set angle1 to 0
    --CONNECT TO GPS
    tell application "GPSNavX"
    	tell first gps
    		if canConnect = true then
    			connect
    		end if
    		repeat until isConnected = true
    		end repeat
    	end tell
    end tell
    repeat
    	--GET GPS DATA
    	tell application "GPSNavX"
    		tell first gps
    			copy latitude to lat
    			copy longitude to long
    			copy sog to spd
    			copy cog to angle
    			
    			--Check for Satilite Fix and Wait for Fix
    			copy fix to fix1
    			with timeout of 30 seconds
    				repeat until fix1 = 1
    					copy fix to fix1
    					if not fix1 = "" then
    						if character -1 of fix1 = "D" then
    							set fix1 to 1
    						else
    							set fix1 to 0
    						end if
    					end if
    				end repeat
    			end timeout
    		end tell
    	end tell
    	
    	--Strip text from spd
    	set spd to characters 1 thru -5 of spd as string
    	
    	--Stri text from angle
    	set angle to characters 1 thru -6 of angle as string
    	
    	--Format Long
    	set long1 to characters 1 thru 3 of long as string
    	set long2 to characters 5 thru 9 of long as string
    	set long3 to the last character of long
    	
    	--Convert Degree's to Decimal
    	set long2 to long2 / 60
    	set long to long1 + long2
    	
    	--If West negative number
    	if long3 = "W" then
    		set long to "-" & long as string
    	end if
    	
    	--Format Lat
    	set lat1 to characters 1 thru 2 of lat as string
    	set lat2 to characters 4 thru 8 of lat as string
    	set lat3 to the last character of lat
    	
    	--Convert Degree's to Decimal
    	set lat2 to lat2 / 60
    	set lat to lat1 + lat2
    	
    	--If South negative number
    	if lat3 = "s" then
    		set lat to "-" & lat as string
    	end if
    	
    	--1 Knot = 1.15077945 MPH
    	set MPH to spd * 1.15077945
    	
    	--Range = 300 + 1.5 * speed
    	set range to 300 + (1.5 * MPH)
    	
    	--Tilt angle = 99% of current speed
    	set tilt to MPH * (99 / 100)
    	
    	--Don't change angle data unless moving
    	if spd < 1 then
    		set angle1 to angle1
    	else
    		set angle1 to angle
    	end if
    	
    	
    	--Generate KML File
    	set XMLFile to {class:XML element, XML tag:"kml", XML attributes:{xmlns:"http://earth.google.com/kml/2.0"}, XML contents:{{class:XML element, XML tag:"Placemark", XML contents:{{class:XML element, XML tag:"Name"}, {class:XML element, XML tag:"LookAt", XML contents:{{class:XML element, XML tag:"longitude", XML contents:long}, {class:XML element, XML tag:"latitude", XML contents:lat}, {class:XML element, XML tag:"range", XML contents:range}, {class:XML element, XML tag:"tilt", XML contents:tilt}, {class:XML element, XML tag:"heading", XML contents:angle1}}}, {class:XML element, XML tag:"Style", XML contents:{{class:XML element, XML tag:"IconStyle", XML contents:{class:XML element, XML tag:"Icon", XML contents:{{class:XML element, XML tag:"href", XML contents:"root://icons/palette-4.png"}, {class:XML element, XML tag:"x", XML contents:"32"}, {class:XML element, XML tag:"y", XML contents:"128"}, {class:XML element, XML tag:"w", XML contents:"32"}, {class:XML element, XML tag:"h", XML contents:"32"}}}}}}, {class:XML element, XML tag:"Point", XML contents:{{class:XML element, XML tag:"coordinates", XML contents:long & "," & lat & "," & 0}}}}}}}
    	generate XML XMLFile saving as file "Macintosh HD:Users:Shared:GPS-XML.kml"
    end repeat
    I drove around town a bit and it tracked perfectly.
    The view angle and distance is based on your current speed.

    Make sure you ahve GPSNavX and the PHP generator linked earlier.
    Make sure you have a GPS lock before you run the script, it should be ok if the sat drops while traveling.
    Of course I only learned applescript as I did this, so it may be buggy, but it works for me even after going into sleep and back.

  3. #33
    Low Bitrate
    Join Date
    Jan 2006
    Posts
    88
    http://bbs.keyhole.com/ubb/showflat....&Number=121471

    This is what I was talking about!!

    EDIT: Wow, that's awesome...I'll have to try that out, eventually. Right now all i've got for a setup is a mac mini.

  4. #34
    Low Bitrate
    Join Date
    Jan 2006
    Posts
    88
    all we need now is a lightweight and free nmea reader prog

  5. #35
    Constant Bitrate zapwizard's Avatar
    Join Date
    Aug 2002
    Location
    Austin, TX
    Posts
    149
    GPSNavX demo program is unlimited run time, and works perfectly.

    What would be better is just to access the serial port directly.
    Later I would like to add controls, make it a whole application.

  6. #36
    Low Bitrate
    Join Date
    Jan 2006
    Posts
    88
    agreed...and i'd love to help add controls for a full on app.

    I'm thinking some sort of voice reading the directions of a route.
    A route creation wizard type thing...you know to plan a road trip or whatever.
    Maybe something that gets routes from mapquest and translates the text from them to a kml file.

    The cool thing about this is the development shouldn't take all the long and would be easy to colaborate on.

    (Here I go, getting myself into another project)

  7. #37
    Constant Bitrate zapwizard's Avatar
    Join Date
    Aug 2002
    Location
    Austin, TX
    Posts
    149
    Google Earth can do all the routing, there is no need for anything else.
    You could export your route to a KML file, have a script read that, and use that for voice prompts
    Applescript and OSX has easy built-in voice reading.
    It's as simple as [say "Your are here"]

    Basicly what you would do is calculate how close you are to a waypoint, say with-in 1/2 mile or so (depending on current speed).
    Then have the script read off the Google text of that waypoint.

    Example:
    Current location: -97.486,35.534
    Check all waypoints in KML file xxxx.kml and compare to current location.
    Waypoint: -97.500,35.600
    Is location with-in 1/2 mile? If yes:
    then check if heading of waypoint is close to current heading, If yes:
    Then speak <name> of waypoint.

    I have no more time to work on this before I leave but here are my goals:
    -Direct Serial port NMEA extraction
    -GUI interface for all controls
    -Better error handling
    -In-Google Earth GPS stats

    Seperate scripts for:
    -Plot your travel path into a KML file live.
    -Read a KML file and provide voice prompts.

  8. #38
    Low Bitrate
    Join Date
    Jan 2006
    Posts
    88
    I would love to get involved in this. Currently I'm writing an itunes interface and will probably beta that soon and or join another itunes/music/unified interface project.

    You say that you are leaving...where are you going and will you continue this sort of development or leave it up to the community?

  9. #39
    Constant Bitrate zapwizard's Avatar
    Join Date
    Aug 2002
    Location
    Austin, TX
    Posts
    149
    No I am leaving on a long car trip.
    Hence all the rush to get this working so fast.
    I installed my Mac Mini in my car just last week.
    Mac Mini in a Mazda Protege

  10. #40
    Constant Bitrate zapwizard's Avatar
    Join Date
    Aug 2002
    Location
    Austin, TX
    Posts
    149
    I am supprised there is no feedback on this.

    Well the mini and my GPS script worked for 4000 miles.
    I drove in just about every possible road type, long desert, canyons, windy switch backs, downtown vegas, suburbs.
    I have some ideas for tweaking the script, basicly better view positioning in a variety of circumstances.

    The Google Earth Cache files worked well, although sometimes the graphic data wasn't high-res.

Page 4 of 6 FirstFirst 123456 LastLast

Similar Threads

  1. Embedding Google Earth to RR
    By Asskick in forum Road Runner
    Replies: 11
    Last Post: 02-10-2006, 10:44 AM
  2. Embedding Google Earth
    By 106-Quiksilver in forum GPS
    Replies: 2
    Last Post: 12-06-2005, 01:03 PM
  3. Google Earth and GPS
    By timdastis in forum GPS
    Replies: 14
    Last Post: 09-15-2005, 09:23 AM
  4. Google Earth
    By liquid_smoke in forum GPS
    Replies: 40
    Last Post: 07-10-2005, 10:53 PM
  5. google earth
    By Ascension in forum Software & Software Development
    Replies: 1
    Last Post: 06-30-2005, 06:35 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •