How To Insert SPOT Shared Data Document

advertisement
How To Use SPOT On Your Web Site
Example 1: SPOT XML data
The SPOT shared page is built upon an XML data stream that is enabled when a
new shared page is created. For example if the shared page url is:
http://share.findmespot.com/shared/faces/viewspots.jsp?&glId=0XapxKiqW
4RCHYhVkaCBpaHT3cNMUcEef
Then the underlying XML data can be retrieved from:
http://share.findmespot.com/messageService/guestlinkservlet?glId=0Xapx
KiqW4RCHYhVkaCBpaHT3cNMUcEef
The XML returned will look something like :
<messageList>
<message>
<esn>0-7341007</esn>
<esnName>Jono SPOT</esnName>
<messageType>TEST</messageType>
<messageDetail>This is a Test message. The device is
powered on and is working.</messageDetail>
<timestamp>2008-05-20T10:52:55.000-07:00</timestamp>
<timeInGMTSecond>1211305975</timeInGMTSecond>
<latitude>37.425</latitude>
<longitude>-121.8958</longitude>
<nearestTown>Milpitas, CA, US</nearestTown>
<nearestTownDistance>0 km(s)</nearestTownDistance>
</message>
<message>
<!-- Snipped for Brevity -->
</message>
<message>
<!-- Snipped for Brevity -->
</message>
</messageList>
The XML schema is included in Appendix A of this document.
The XML document will contain 0 or more messages. Only the messengers and
message types enabled by the customer will be available in this data stream.
Also note that the XML data is cached by our servers. *The message service
should be called no more frequently than every 15 minutes, since the data
is cached and data will not be made available any faster. In addition,
viewing limits are imposed on all shared page links and abuse of this
feature may cause the viewing limits to come into effect. Viewing limits are
currently reset on a weekly basis*.
For server->server synchronization of data this method may not be optimal. The
SPOT development team will be providing an additional message sync
mechanism that will provide non-cached access to the data and provide
additional control to retrieve only the new message data and not the full message
history. Additional information may be required from our customers to use this
feature. Please contact the SPOT product team for more information on this
service.
Example 2: Using Yahoo! Pipes to view SPOT data in Google Maps for
Mobile & Google Earth
Yahoo pipes is a powerful composition tool to aggregate, manipulate, and
mashup content from around the web.
Like Unix pipes, simple commands can be combined together to create output
that meets your needs:




combine many feeds into one, then sort, filter and translate it.
geocode your favorite feeds and browse the items on an interactive
map.
power widgets/badges on your web site.
grab the output of any Pipes as RSS, JSON, KML, and other formats.
When you create a SPOT shared page, the data from your account is also made
available in an XML format. Using this data it is possible to integrate with Yahoo!
Pipes and create some powerful features. In order to run this example on your
own SPOT data, you will also need a Yahoo! Pipes account (if you already have
a Yahoo account it is very easy to setup a pipes account).
A number of customers have asked about getting the SPOT message data
displayed on a mobile version of Google Maps. In this example we create a
Yahoo! Pipe that converts SPOT shared data and allows that data to be viewed
by Google maps on your mobile phone (using the appropriate Google Maps for
mobile installed on your phone).
Native support for Google’s KML message format is not yet built into the SPOT
shared data. However, Yahoo! Pipes provides KML support by default as one of
the output formats once your pipe has been created and run. For this example
our pipe will need to do the following :
1. Ask the user for the Guest Link ID. (this is the very last part of the SPOT
Shared page link.
2.
3.
4.
5.
6.
So for example if the full URL is:
http://share.findmespot.com/shared/faces/viewspots.jsp?&glId=0Xap
xKsaW5RCHYhVkaCBpaHT9cNMUcEea
Then the user will just enter:
0XapxKsaW5RCHYhVkaCBpaHT9cNMUcEea
The pipe will then build a URL that points to the Shared page data stream
using this ID. (it first creates a String by concatenating the base URL with
the ID and then converts it to a URL)
The XML data stream URL will then look something like:
http://share.findmespot.com/messageService/guestlinkservlet?glId=0
XapxKsaW5RCHYhVkaCBpaHT9cNMUcEea
The pipe will then parse the XML data stream made available by the
SPOT shared page
It will truncate the number of messages to only include the last 9 locations
(Google Maps for mobile can only display a maximum of 9 locations at any
one time. So there is no need to pass any more data)
Loop through the SPOT data to perform additional formatting on the
message time/date and also rename (re-label) some of the fields. In the
SPOT xml data, the GPS timestamp of the message is stored in a long
(unix time) format.
Finally the pipe runs the data through Yahoo!’s location extractor. This will
convert the latitude longitude information into a format that Yahoo can
then use to build the final output (& KML).
We have published this SPOTPipe as an example. The URL of the published
pipe is:
http://pipes.yahoo.com/pipes/pipe.info?_id=ilTIBqET3RGhtnJal7okhQ
You can simply clone this pipe for your own use and edit it for your own needs.
The Yahoo! Pipes site uses simple drag and drop mechanisms to configure these
steps. You will only need to enter the Shared Page ID from your link to have it
work with your own data. The final pipe will look something like this.
If we run the pipe, Yahoo will retrieve the latest SPOT data and process it using
the pipe that we have setup. By default, if it recognizes any location information it
will display it on a yahoo map.
Yahoo! provides a number of ways to use the pipe output. Clicking on ‘more
options’ you will see the different formats that it will convert to.
For example, right click on the “Get as KML” option. It will provide you with a
KML link to the pipe.
It will look something like this:
http://pipes.yahoo.com/pipes/pipe.run?SPOTGuestLinkID=0XapxKiqW4RC
HYhVkaCBpaHT9cNMUcEea&_id=ilTIBqET3RGhtnJal7okhQ&_render=kml
Loading the data feed into Google Maps for Mobile
Assuming your SPOT shared page is still active and you are actively using your
messenger, this link can now be used to load your last known SPOT location
data into Google Maps Mobile.
For example, on a Palm Treo with Google Maps mobile installed, select the “Find
Nearby Business” menu option. In the “Search near the map center for“ field
enter the KML link that you created (like the one shown above). Alternatively you
can use a URL shortening service like (tinyurl.com) to produce a short URL for
the Yahoo KML url above. Google Maps for mobile will now pull the data from the
KML feed and display the locations.
Loading the data feed into Google Earth
Google Earth can also display the same feed. First load up google earth and then
from the “Add” menu select the “Network Link…” option. Give the network link a
name, paste the Yahoo! Pipe KML URL into the Link field. If you would like
Google Earth to check the feed periodically you can use the refresh options to
pull the data automatically, lets say every 15 minutes.
Here is the same feed shown in Google Earth:
Appendix A (SPOT shared message XML Schema)
<?xml version="1.0" encoding="UTF-8"?>
<!-- edited by Zheng Zhu (Globalstar) -->
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
elementFormDefault="qualified"
attributeFormDefault="unqualified">
<xs:element name="messageList">
<xs:annotation>
<xs:documentation>A list of messages get from the
message servlet</xs:documentation>
</xs:annotation>
<xs:complexType>
<xs:sequence maxOccurs="unbounded">
<xs:element name="message">
<xs:complexType>
<xs:sequence>
<xs:element name="esn" type="xs:string">
<xs:annotation>
<xs:documentation>This is the DEVICE ESN
field</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element name="esnName" type="xs:string"
minOccurs="0"/>
<xs:element name="messageType" type="xs:string" />
<xs:element name="messageDetail" type="xs:string"
minOccurs="0">
<xs:annotation>
<xs:documentation>Detailed Message in
TEXT</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element name="timestamp" type="xs:dateTime">
<xs:annotation>
<xs:documentation>Time Message sent in GMT
time</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element name="timeInGMTSecond" type="xs:string"
minOccurs="0"/>
<xs:element name="latitude" type="xs:string"
minOccurs="0"/>
<xs:element name="longitude" type="xs:string"
minOccurs="0"/>
<xs:element name="nearestTown" type="xs:string"
minOccurs="0"/>
<xs:element name="nearestTownDistance"
type="xs:string" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
Download