Re: GPS Coordinates in Tiny SVG

Hi

Here is an update for "Enable to use of GPS Coordinates in SVG":

Requirements:
    long,lat, height above See Level, time of measurement,
   Status of Satelite Connection

Events:
       There are some events a GPS modul COULD send to SVG:
           onGPSChangeStatus,
           onGPSChangePosition,
           onGPSsignal,
           onGPSmove,
           onGPSConnectionLost
           onGPSConnectToSatelite
          ...

Simple Event Model:
       "onGPSsignal"
      If the GPS modul receives a signal and calculates position, the 
Event "onGPSsignal" will be fired.
      If the GPS modul does not receive a proper signal, there is NO 
Event (no error event).
      SVG may loose focus, the onSVGSignal event  is still important for 
drawing traces.
     

Pointer Device  vs. GPS Device
       GPS can loose connection to satelite
       GPS fires onGPSsignal in variable time interval. If the GPS modul 
does not move, the coordinates maybe will not change - but the 
"onGPSsignal" Event fires. (100% CPU for redraw?)

Not covered:
      How often the GPS modul fires the event "onGPSstatus" is not defined
      Privacy Protection
     The Term "GPS" is not good if Gallileo Signal is received



This is my conclusion:
================

<item title="to be done in SVG or DOM or XML Events or Salzamt">

         evt.gpsLong  (signed dezimal; eample: "-56.234433")
         evt.gpsLat (signed dezimal; example: "23.3433")
         evt.gpsHeight (in meter above elipsoid; example "2145.5" (no unit))
         evt.gpsTime (GMT, timeformat ?????)

        EVENT: onGPSsignal  

</item>
(maybe not so important: precision, number of satelites)
-------------------------------------------------------------------------
Privacy Protection:
    There must be a mechanism to prevent giving GPS location to SVG if 
the User don't want (similar to cookie).
    If this could be turned on/off using javascript it would be useless 
-> not in the scope.
    If GPS data are available they will be used as parameter for 
Client/Server communication.
    There is no mechanism to use GPS Data in ClientSide scripting and 
protect privacy at the same time.
  
Done by Javascript (or other languages):
    o other units like feed
    o speed, direction
    o convert to other Coordinate Systems (enjoy the WGS-84 calculation)
    o statuscheck


========================================================

Here an example how to use GPS in SVG - this is not real ecmaScript - it 
will not work without changes!!!




<svg onGPSsignal="redrawMap(evt);|setInterval("checkstatus","1000")|" 
xmlns="http://www.w3.org/2000/svg" version"=1.2 Tiny">
<!--
SVG Map that follows GPS coordinates
description: The center of the map is the GPS position. If GPS 
coordinates change the map will move and a trace is drawn
author: Bernhard Zwischenbrugger
copyright: Public Domain //copy, sell, destroy - do what you want with this
this is pseudo code (not real javascript / not runable)
-->
<script type="text/javascript">
//globals
var lastupdate=null;  

function redrawMap(evt){
       //onGPSsignal fires only if there is a connection to satelites
       lastupdate = evt.gpsTime;
       movinger=svgDocumeng.getElementById('movinger');
       movinger.setAttribute("translate","translate("+evt.gpsLong 
*-1+","+evt.gpsLat *-1+")";
       drawPath(evt);
}
function checkstatus(){
       //pseudo code -  time format not clear -> calculation not possible
       var now=new Date();
       if((now - lastupdate) > 10 min){
             alert("signal lost");
       }
}
function drawPath(evt){
      var path=svgDocument.getElementById('trace');
      var points=path.getAttribute('d');
      points=points.concat(" l "+evt.long+" "+evt.lat);
     path.setAttribute("d",points);
}
</script>
       <!-- center is  0,0 -->
       <circle r="20" fill="none" stroke="black"/>

    <!-- move to gps coordinates (redrawMap)-->
    <g id="movinger">

        <!-- scale your view -->
       <g translate="scale(5600)" id="scalinger">

             <!-- satelite image - have google map in mind -->
              <image x="-43.2342342" y="23.2342344" width="0.00100" 
height="0.00100" xlink:href="http://kh.google.com/kh?v=3&t=trtqttt"/>

             <!-- now the Metadata -->
              <circle id="new york" x="-43.2323423" y="23.223423" 
r="0.0000100" fill="none" stroke="red"/>
              <circle id="vienna" x="-43.2333423" y="23.225423" 
r="0.0000100" fill="none" stroke="red"/>
             <path id="trace"/>
       </g>
</g>
</svg>


-----

Links:
======

GPS Communication format:
NMEA-0183:
http://de.wikipedia.org/wiki/NMEA

In German:
http://www.kowoma.de/gps/zusatzerklaerungen/NMEA.htm
--------

GoogleMaps
Version: 2
http://en.wikipedia.org/wiki/Plate_carr%C3%A9e_projection
Version: 3
http://de.wikipedia.org/wiki/Mercator-Projektion

GPS Trace in XML Format:
http://www.topografix.com/fells_loop.gpx


thanks for reading

Bernhard Zwischenbrugger

Received on Wednesday, 31 August 2005 15:15:13 UTC