Author Topic: Link to google maps?  (Read 14063 times)

rh4600

  • Newbie
  • Posts: 1
    • View Profile
Link to google maps?
« on: 12 May 2013, 11:06:25 »
Hi

I'm using PDW to decode message from firedepartment in Denmark. All message come with a GPS cordinate, exsample: GPS=5535.5520 N 01219.3210 E. I can find this adress with google map by typing 55 35 55.20 N, 012 19 32.10 E

But it could be very smart if I could get a link to google map in the mail PDW send.

Could anyone make this in PDW?

BR
René

Scott

  • Member
  • *
  • Posts: 2
    • View Profile
Re: Link to google maps?
« Reply #1 on: 20 May 2014, 05:13:44 »
Hi Rene
I just signed up to this forum and thought I would offer my 2 cents worth - Although you most likely have found a solution but perhaps somebody will find this useful.
I am developing a turnout system for my emergency service and employing something similar to this with some other parts of the page output.

My approach to this would be..
eg, running PDW on windows you could do the following, provided that your page message follow a STRICT format and that the GPS coordinates are ALWAYS in the same starting position:

1. Set your PDW filters as required
2. Create a windows batch file to pipe out the text to a log file

echo %* >> sometextfile.txt

3. Run the batch file as an output command, and Enable %7 (the message) as your argument. (you can add the rest too if you want the date/time etc %1 %2 %3 %4 %5 and so on - just keep it consistent)
4. Once your text file is populated with some sample pager messages you can open the text document in an editor that shows you the columns
You then take note of your START column and the END column of the GPS coordinates.
What you need to know is 'how many characters through the message is the start of the GPS numbers that I need to pass to google... AND how many characters is the LAST'

5. Go back to your batch file
If you are just piping out %7 from PDW (the message) then the batch file will input that argument as %* (every word starts as %1 %2 %3 -- and all pager messages have spaces!)
if you are piping out the cap code and date etc, then for each single word it is %1 %2 %3 and so on, with %7 being the first word of the page message.

Using this example, lets say you are piping out the full output, your GPS coordinates are 91 characters inside the message and your message always starts out like this
1234567 11:57:08 20-05-14 POCSAG-1  ALPHA   512 @@ALERT F140511111 There is a fire at GPS=5535.5520 N 01219.3210 E Some other information, blah blah, [SOMTHING]

In your batch file you will need to create a few variables. One to hold the message so you can trim it, one for the input of the GPS grid, and another to change the string to a google friendly format. something like this

SET MSGINPUT=%*
SET GPSINPUT=%MSGINPUT:~91,25%

What these two lines should do is strip out all the code before and after the GPS numbers giving you only 5535.5520 N 01219.3210 E (assuming of course that your GPS figures always are sent as 25 characters including spaces)

You will then need to take the GPSINPUT and convert it to a Google friendly format, with again another variable.
There are probably a few better ways to go about it but lets break that up a bit..something... like this

SET GPSOUTPUT1=%GPSINPUT:~0,-23%
SET GPSOUTPUT2=%GPSINPUT:~2,-22%
.. you get the idea. This would create a variable of GPSOUTPUT1=55, GPSOUTPUT2=35
You would split this all up so that you have a variable with
55
35
55.20 N,

and

012
19
32.10 E

Once you have all these variables (or something more fancy/ smaller)
combine them as a single variable

SET GOOGLEGPS=%GPSOUTPUT1% %GPSOUTPUT2% %GPSOUTPUT3%
(and so on and so forth)

Thats all well and good but then you need the correct formed google URL. Ok, keep going

SET GOOGLEGPSURL=https://www.google.com.au/maps/place/%GOOGLEGPS%/@55.5986667,12.3255833,15z/data=!3m1!4b1!4m2!3m1!1s0x0:0x0

Notice the %GOOGLEGPS% will be your dynamic grid, hopefully google/browser will insert %'s for your spaces or you may need to adjust this yourself, all the stuff after the last / I believe are your zoom features etc so you can go to https://www.google.com.au/maps/place/55%C2%B035'55.2%22N+12%C2%B019'32.1%22E/@55.5986667,12.3255833,15z/data=!3m1!4b1!4m2!3m1!1s0x0:0x0 and zoom/etc then get the new URL.

From here,
6. Create your batch file /  clean it up
you can then create a text file with a link in it to be emailed, or go all out and create a dynamic HTML document via the batch file.

simply use echo.

ECHO <HTML> >> email.html
... and so on, using a new line
OR text file...

When you are ready, echo out the URL variable you created as either a HREF or raw link. (most phones/email clients will see it and convert to a url anyway right?)

ECHO <a href="%GOOGLEGPSURL%">Click here for the map</a> >> email.html

7. Once you are happy with your desired email format
Send the email as part of your batch script using one of the many free STMP email command line tools/senders (google it)
call your email program within the batch

eg

sendemail.exe email.html /arguments specific to app


one final tip, avoid the heartache and declare a variable for your email file, perhaps based on unique random/capcode or something.
>> Appends, and you dont want a large file emailing you, you want to delete/renew the file each time

Good luck!

Scott

Scott

  • Member
  • *
  • Posts: 2
    • View Profile