Skip to content

Instantly share code, notes, and snippets.

@aaronpk
Created April 30, 2010 16:47
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save aaronpk/385459 to your computer and use it in GitHub Desktop.
Save aaronpk/385459 to your computer and use it in GitHub Desktop.
A JSON protocol for sharing and storing real-time data streams. Common use would be for sharing location data.
Common minimal format for sending just lat/long data
[
{
uuid: "550e8400-e29b-41d4-a716-446655440000",
date: "2010-04-30T16:50:00Z",
location: {
position: {
latitude: 45.5118,
longitude: -122.6433
}
},
client: {
name: "Geoloqi",
version: "0.1",
platform: "iPhone OS 4"
}
},
{
uuid: "550e8400-e29b-41d4-a716-446655440001",
date: "2010-04-30T16:50:00Z",
location: {
position: {
latitude: 45.5128,
longitude: -122.6435
}
},
client: {
name: "Geoloqi",
version: "0.1",
platform: "iPhone OS 4"
}
}
]
Full data format allowing custom information to be included based on source of location data
[{
uuid: "550e8400-e29b-41d4-a716-446655440000",
date: "2010-04-30T16:50:00Z", (iso8601 format)
location: {
position: {
latitude: 45.5118,
longitude: -122.6433,
geojson: {
type: "Polygon",
coordinates: [[-122.643, 45.512], [-122.650, 45.512], [-122.643, 45.533], [-122.650, 45.533]]
},
altitude: null,
heading: 190,
speed: 56,
horizontal_accuracy: 6.0,
vertical_accuracy: 8.0 (in meters)
}
source: "hardware_gps,wifi,street_address,agps,twitter,foursquare,geomena"
type: "latlng,address,neighborhood,city",
raw: (from hardware gps device) {
dop_h: 2.7,
dop_v: 2.1,
satellites: []
},
raw: (from wifi positioning) {
aps: []
}
raw: (from twitter) {
id: "103994853",
created_at: "Tue Apr 07 22:52:51 +0000 2009",
text: "At least I can get your humor through tweets. RT @abdur: I don't mean this in a bad way, but genetically speaking your a cul-de-sac.",
source: "<a href="http://www.tweetdeck.com/">TweetDeck</a>",
....etc....
}
},
client: {
name: "Geoloqi",
version: "0.1",
platform: "iPhone OS 4",
other: "whatever"
},
environment: {
air_temperature: {
celsius: 20.3
},
humidity: {
percent: 80
},
sound_pressure_level: {
pascals: 10
}
},
body: {
heart_rate: {
bpm: 100
},
core_temperature: {
celsius: 25
}
}
}]
Format for querying positions of multiple users:
[{
user: {
id: "http://aaron.pk",
display_name: "aaronpk",
url: "http://aaronparecki.com",
image_url: "http://aaron.pk/pic.jpg"
},
data: []
},
{
user: {
id: "@caseorganic",
display_name: "caseorganic",
url: "http://oakhazelnut.com",
image_url: "http://a1.twimg.com/profile_images/116264220/kk-caseorganic-48px.jpg"
},
data: []
}]
@aaronpk
Copy link
Author

aaronpk commented May 19, 2010

Consideration: How do you log a point with no center point, such as a city. If I want to log the fact that I'm in Portland, but without marking a specific point on the map. Maybe omitting "position" in favor of "geo_json," or maybe making the "position" element a geo_json block instead?

@max-mapper
Copy link

it would make a lot of developers happier if you represent all geometries in geojson, as it would be pretty pointless to re-implement a json representation of geo data

example: http://data.pdxapi.com:5984/bicycle_parking/f0f6b0d5927d01880f3824585b161ace

@donpdonp
Copy link

aaronpk and I talked some about geojson. at minimum a position is a lat/long/accuracy, which is also a circle. geojson does polygons, which means to do a radius is estimating a circle with X points. very verbose way to draw a circle. also going from a geojson polygon to a lat/long/accuracy value would be difficult at best.

That being said, a geoJson polygon for position would be very useful for non-GPS style checkins. If I am checking into a park, having the outline of the park be my 'position' would work well. since lat/long/acc are required, the client would take a best guess at the centerpoint in addition to the geoJson data.

@pmark
Copy link

pmark commented May 30, 2010

I wonder if a collection of checkins could be of use in implementing a sort of differential correction. Location accuracy might be able to be increased by comparing some aspect of the user's perspective to the same aspect of nearby checkins.

For example, if nearby checkins included a photograph of some fixture in the users' environment (like a building with distinctive lines, a rock formation, a fiducial marker) along with camera inclination and heading, it might be possible to narrow down the user's current position.

Could a checkin leave behind some kind of breadcrumb (like correction data) that improves future checkin accuracy?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment