realtek
Posts: 34
Joined: Wed Jan 09, 2013 3:16 pm

GPS + Google Maps

Fri Jan 11, 2013 11:09 pm

Hi,

I was wondering if anyone had any information on how I can hook up a GPS to the Pi, get coordinates and map this on a google map or some kind of service that can be accessed remotely?

Its project I am working on and currently!

Thanks!

Carnildo
Posts: 15
Joined: Wed Jan 09, 2013 7:51 am

Re: GPS + Google Maps

Sat Jan 12, 2013 7:20 am

The first thing you'll want to do is install GPSD: it's the standard Linux software for interfacing between GPS receivers and programs. After that, it depends on the details of what you're trying to do: I believe both Chrome and Firefox can take data from GPSD and make it available to Javascript, or you might need to write your own program.

-rst-
Posts: 1316
Joined: Thu Nov 01, 2012 12:12 pm
Location: Dublin, Ireland

Re: GPS + Google Maps

Mon Jan 14, 2013 5:23 pm

hook up a GPS to the Pi - possible options (provided that RPi supported hardware found):
- Bluetooth GPS + bluetooth usb dongle
- GPS with USB cable (implementing a serial device)
- GPS with serial cable + serial-2-usb converter
- GPS with serial cable + converter to UART GPIO pins (need to turn off debug output to UART, search for a thread about connecting a MIDI device)
- Arduino etc GPS development module + some extra components to GPIO

get coordinates:
- use the gpsd already suggested
- raw reading of NMEA messages from serial input (some threads about this already)

map this on a google map or some kind of service that can be accessed remotely:
- assuming this means sending the location of the RPi to some remote service, use a http library to connect to the service and store the location using the service API (possibly 'the internet of things')
- if this is about getting the map to the RPi, you could look at doing a http request to Google Maps API ('static API')

Serial reading, parsing the coordinates and calling http services is somewhat easily programmed using Python.
http://raspberrycompote.blogspot.com/ - Low-level graphics and 'Coding Gold Dust'

pishi
Posts: 1
Joined: Thu Jan 17, 2013 8:24 pm

Re: GPS + Google Maps

Thu Jan 17, 2013 8:36 pm

I am also wondering about the same things as 'realtek'...

I must say that I have already searched about this matter both here on this site and on google, but I haven't been able to find any good and simple explanations. I am new to linux and not able to do any programming on my own.

So... I have already a RPi that I have managed to connect to internet by using a 3G USB modem and also through WiFi.
My GPS is also working and I have 3D FIX by using gpsd and cgps.

But from here I'm totally lost...

I want my coordinates (the Pi) to be pushed forward ... either using email... webserver... or even be able to import it directly to a map application that is supposed to run on a different computer. In other words.. I want to see the coordinates remotely.

Could somebody with the knowledge please explain this since I still haven't been able to find them anywhere else. Thanks! :)

Love the Pi btw.

-rst-
Posts: 1316
Joined: Thu Nov 01, 2012 12:12 pm
Location: Dublin, Ireland

Re: GPS + Google Maps

Wed Jan 23, 2013 4:20 pm

Oh... there are so many different ways to accomplish this and no ready-made solutions...
http://raspberrycompote.blogspot.com/ - Low-level graphics and 'Coding Gold Dust'

User avatar
topguy
Posts: 3508
Joined: Tue Oct 09, 2012 11:46 am
Location: Trondheim, Norway

Re: GPS + Google Maps

Wed Jan 23, 2013 4:49 pm


-rst-
Posts: 1316
Joined: Thu Nov 01, 2012 12:12 pm
Location: Dublin, Ireland

Re: GPS + Google Maps

Wed Jan 23, 2013 5:30 pm

Wonder if Google Earth runs on RPi?
http://raspberrycompote.blogspot.com/ - Low-level graphics and 'Coding Gold Dust'

User avatar
topguy
Posts: 3508
Joined: Tue Oct 09, 2012 11:46 am
Location: Trondheim, Norway

Re: GPS + Google Maps

Thu Jan 24, 2013 9:31 am

-rst- wrote: Wonder if Google Earth runs on RPi?
No. There is no open source version of GE as far as I know.
But there should exist a lot of different mapping applications that might be sucessfully ported to RasPI.

These ones for example.
http://qtmapper.garage.maemo.org/
http://wiki.openstreetmap.org/wiki/MoNav

-rst-
Posts: 1316
Joined: Thu Nov 01, 2012 12:12 pm
Location: Dublin, Ireland

Re: GPS + Google Maps

Thu Jan 24, 2013 12:44 pm

Yep, porting a map app to RPi would be interesting - especially if could use the hw accelerated graphics.

In most cases however, the location of the RPi is required to be monitored somewhere else...

Looks like gpsd provides a sort of web-service: 'presents reports in a well-documented JSON application on port 2749' http://savannah.nongnu.org/projects/gpsd ...so could connect from outside world using just a web-browser (for testing and quick checks) or create an application that connects to read the location...

I would most likely choose to code a small program in Python to run on RPi:
- read the data from gpsd (there are at least a couple of gpsd compatible Python libraries)
- format the data into KML
- push the data to for example COSM (https://cosm.com/) using a HTTP connection to access their API - alternatively could just ftp to personal web-page space or similar
Then could view the location on Google maps specifying the URL to the stored KML...

(Any beginner programmer should start by trying to implement one of the bullet points at a time - begin with any mock-up data...)
http://raspberrycompote.blogspot.com/ - Low-level graphics and 'Coding Gold Dust'

User avatar
PacificDragon64
Posts: 29
Joined: Thu Aug 09, 2012 8:20 pm
Location: Vancouver, Canada

Re: GPS + Google Maps

Sat Jan 26, 2013 7:49 pm

I managed to install GPSD and a few mapping softwares from the Repository (foxtrotgps, qlandkartegt). I connected my Garmin GPS device to the Pi via USB to Serial cable. It all worked, but terribly slow for my liking. I noticed that adafruit has a GPS breakout module able to interface via GPIO. i wonder if this would be a better solution....much faster i would think. it's only $40. I might give it a whirle.
Cheers!

:-)

BillyRayPreachersSon
Posts: 7
Joined: Tue Feb 05, 2013 4:06 pm
Location: London

Re: GPS + Google Maps

Tue Feb 26, 2013 4:43 pm

The gpsprune package (http://packages.debian.org/squeeze/gpsprune) runs successfully for me on the RPi, even over ssh+X11 on my Mac:

Code: Select all

sudo apt-get install gpsprune
I've yet to try getting gpsd-logged data into it, but the package details sound very good indeed:
Prune is an application for viewing, editing and converting coordinate data from GPS systems. Basically it's a tool to let you play with your GPS data after you get home from your trip.

It can load data from arbitrary text-based formats (for example, any tab-separated or comma-separated file) or XML, or directly from a GPS receiver. It can display the data (as map view using OpenStreetMap images and as altitude profile), edit this data (for example delete points and ranges, sort waypoints, compress tracks), and save the data (in various text-based formats). It can also export data as a GPX file, or as KML/KMZ for import into Google Earth, or send it to a GPS receiver.

Some example uses of Prune include cleaning up tracks by deleting wayward points - either recorded by error or by unintended detours. It can also be used to compare and combine tracks, convert to and from various formats, compress tracks, export data to Google Earth, or to analyse data to calculate distances, altitudes and so on.

Furthermore, Prune is able to display the tracks in 3d format and lets you spin the model round to look at it from various directions. You can also export the model in POV format so that you can render a nice picture using Povray. You can also create charts of altitudes or speeds. It can also load Jpegs and read their coordinates from the EXIF tags, and export thumbnails of these photos to Kmz format so that they appear as popups in Google Earth. If your photos don't have coordinates yet, Prune can be used to connect them (either manually or automatically using the photo timestamps) to data points, and write these coordinates into the EXIF tags.
Dan


GMan2XS
Posts: 7
Joined: Tue Sep 18, 2012 3:44 pm

Re: GPS + Google Maps

Thu Jun 06, 2013 7:14 pm

I know this thread is a bit old, but I've been working on something similar recently. I have one of my Pis powered by a battery pack so it can be mobile. This is connected via Bluetooth to a GPS receiver. It also has one of the new Pi camera boards attached. The whole thing is held in a pack which is fitted on the front of my bike. When I go cycling a python script is running which uses the GPS data to create a KML file which references pictures taken by the camera at regular intervals. When I get home I upload the KML file & the pictures to my network, then load the KML file into Google earth & hey presto, I have a visual record of my ride :D

Komak57
Posts: 5
Joined: Sat Apr 13, 2013 3:36 am

Re: GPS + Google Maps

Thu Jun 06, 2013 7:58 pm

Reviving an old thread, rather than creating a new one.

I recently came into the posession of a Microsoft Prolific Pharos GPS-360 USB device we use to use for Microsoft Streets & Tips. As we currently have 2, I figured why not see what the raspberry can do with it. Researching around I found a few low-quality GPS programs like Mumble, and the communication software known as GPSD. The raspberry pi DOES find the device, and showed the driver properly listed, but GPSD can't seem to see the device. I've tried to research as best I can, but I'm running out of leads. Although this isn't a high priority, it would still be an amusing addition to my future replacement radio for my car.

--
Shortly after making this post, I came across some new information.
Grab all 3 software packages:

Code: Select all

sudo apt-get install gpsd gpsd-clients python-gps
start using:

Code: Select all

sudo gpsd /dev/ttyUSB0 -F /var/run/gpsd.sock
*ttyUSB0 may differ depending on the amount of TTY devices plugged in. Use

Code: Select all

ls /dev/ttyUSB*
to determine yours.
If no errors were found, you may very well be set up to access your GPS coordinates, supposing your GPS doesn't require alternative configurations, it's within range of the sky, and it's a compatible device.

Setup source: http://learn.adafruit.com/adafruit-ulti ... rything-up
Compatibility: http://gpsd.berlios.de/hardware.html

Still trying to research my original question as to what software I should be using with GPSD to track my route. Preferably something with an offline mode to avoid 3G fees and such.

User avatar
riskpw
Posts: 29
Joined: Sun Jan 20, 2013 1:02 pm
Location: korea
Contact: Website

Re: GPS + Google Maps

Mon Jun 10, 2013 10:57 pm


team44
Posts: 1
Joined: Thu Jun 27, 2013 11:59 pm

Re: GPS + Google Maps

Fri Jun 28, 2013 12:07 am

GMan2XS wrote:I know this thread is a bit old, but I've been working on something similar recently. I have one of my Pis powered by a battery pack so it can be mobile. This is connected via Bluetooth to a GPS receiver. It also has one of the new Pi camera boards attached. The whole thing is held in a pack which is fitted on the front of my bike. When I go cycling a python script is running which uses the GPS data to create a KML file which references pictures taken by the camera at regular intervals. When I get home I upload the KML file & the pictures to my network, then load the KML file into Google earth & hey presto, I have a visual record of my ride :D
GMan2XS. I've been planing on doing something very similar. Is there any chance you will be sharing your code and I could use it as a strarting point?
thanks

davenull
Posts: 1162
Joined: Thu Oct 22, 2015 7:22 am
Location: a small planet close to Betelgeuze

Re: GPS + Google Maps

Tue Mar 15, 2016 6:28 pm

retrieving the GPS coordinates ( latitude ang longitude values as doubles, perhaps converted to strings) is easy, also datalogging along a route,
but I also have no clue how to load any street map (Google Earth, OpenStreetMaps) on a Raspi display and show the logged coordinates on that display map, just like on a automobile navigation system, e.g. a TomTom or a Garmin, if possible live view (like in a car).
Finally a TomTom or a Garmin have much less computational power than a Raspi!
#define S sqrt(t+2*i*i)<2
#define F(a,b) for(a=0;a<b;++a)
float x,y,r,i,s,j,t,n;int main(){F(y,64){F(x,99){r=i=t=0;s=x/33-2;j=y/32-1;F(n,50&S){t=r*r-i*i;i=2*r*i+j;r=t+s;}if(S){PointOut(x,y);}}}for(;;);}

davenull
Posts: 1162
Joined: Thu Oct 22, 2015 7:22 am
Location: a small planet close to Betelgeuze

Re: GPS + Google Maps

Thu Mar 17, 2016 7:25 pm

so is there no way to use a Raspi like a car navigation system, with a street map and the current postion polled via GPS on TFT/HDMI screen?
#define S sqrt(t+2*i*i)<2
#define F(a,b) for(a=0;a<b;++a)
float x,y,r,i,s,j,t,n;int main(){F(y,64){F(x,99){r=i=t=0;s=x/33-2;j=y/32-1;F(n,50&S){t=r*r-i*i;i=2*r*i+j;r=t+s;}if(S){PointOut(x,y);}}}for(;;);}

-rst-
Posts: 1316
Joined: Thu Nov 01, 2012 12:12 pm
Location: Dublin, Ireland

Re: GPS + Google Maps

Tue Mar 22, 2016 2:55 pm

http://raspberrycompote.blogspot.com/ - Low-level graphics and 'Coding Gold Dust'

woodcarver
Posts: 3
Joined: Tue Sep 13, 2016 5:13 pm

Re: GPS + Google Maps

Sat Jul 08, 2017 3:18 pm

Some threads die hard :)

I have now managed to quite easily view the GPS location of the Pi in a maps program on my laptop.

First of all, install gpsd and get it running with your GPS if you haven't already. The gpsd daemon needs to be started with the -G switch to allow outside access. And also note that on the Pi 3 the UART (RX/TX) port name has changed from ttyAMA0 to serial0 - remember this when reading old guides!

Code: Select all

sudo gpsd -G /dev/serial0
On your laptop, install QGIS (a map software available for most platforms), and under Plugins install the OpenLayers plugin. Under the Web menu, you will now be able to add a layer of Google Maps or some other map service.

To the left, under GPS Information, there is an option to connect to a remote GPSD service and view the location in real time.

Return to “General discussion”

Who is online

Users browsing this forum: usamasaeed and 59 guests