What does raccoonloc.py do?

raccoonloc.py is a simple Python script which will return the location information of the mobile phone. The script will first try to get the GPS latitude and longitude coordinates from an internal GPS device or from a bluetooth GPS receiver. After this it will get cell id and some other information. The script returns the information in an XML format:

<?xml version="1.0" encoding="UTF-8"?>
<response>
  <lat>60.226448</lat>
  <lon>24.961651</lon>
  <speed>79.9</speed>
  <course>268</course>
  <mcc>244</mcc>
  <mnc>91</mnc>
  <lac>2878</lac>
  <ci>20792</ci>
  <id>raccoonloc_s60v2.6</id>
  <signal_strength>7</signal_strength>
  <battery_level>3</battery_level>
</response>

If there is no GPS coverage or no GPS device then the script will only return the cell id information.

3rd Edition S60 phones note: see the notes in the Setup guide.

raccoonloc.py parameters

The raccoonloc.py script accepts arguments:

  • http://your-mobsite-name/RaccoonOnMap/raccoonloc.py
    http://your-mobsite-name/RaccoonOnMap/raccoonloc.py?m=getLoc
    This is the default. It returns both GPS and cell-id location information.
  • http://your-mobsite-name/RaccoonOnMap/raccoonloc.py?m=getGSM
    This forces the script always return only cell-id location information.

raccoononlyloc.py parameters

The raccoononlyloc.py script accepts arguments:

  • http://your-mobsite-name/RaccoonOnMap/raccoonloc.py/getLoc
    This is the default. It returns both GPS and cell-id location information.
  • http://your-mobsite-name/RaccoonOnMap/raccoonloc.py/getGSM
    This forces the script always return only cell-id location information.

Using an external GPS device

The first time the script is run, it tries to find a bluetooth GPS receiver. It does this by starting a bluetooth discovery to find the address of the receiver. If the receiver is found it will save the address to the file in the mobile (c:\Data\gpsaddress.txt). The next time the script is run (when RaccoonOnMap.html is asking a location update) it will use the address from the file. It will not do bluetooth discovery ever again and it will allways try to make socket connection to the receiver.

If at the first time raccoonloc.py can't find the address of the GPS receiver, it will write an empty string to the file. This tells the script next time not to do bluetooth discovery. The script will for now on always return only cell-id information.

If the GPS address file is removed from the mobile the script will again try to find the bluetooth receiver the next time it is called. The GPS address is stored in c:\Data\gpsaddress.txt.

So, if the first time the script is run and you don't have your GPS receiver with you, then by removing the GPS address file you can make the script redo the bluetooth discovery when you have receiver with you. Or, if the first time you do have GPS receiver and after that you will not have it, then you can again remove then file and let the script make unsuccesfull bluetooth discovery to create an empty file (or edit the file yourself). If the address of the receiver is stored in the file and you don't have receiver on, the connection takes 10+ seconds before socket timeout is reached.

Download

Copy the script from here.