OlpcMAP/data-api: Difference between revisions
(Created page with '=Request URLs= ==Request by Distance from Point== Load points a given distance from a latitude,longitude center with the llcenter variable: http://olpcMAP.net/json?''llcenter=…') |
No edit summary |
||
Line 5: | Line 5: | ||
Load points a given distance from a latitude,longitude center with the llcenter variable: |
Load points a given distance from a latitude,longitude center with the llcenter variable: |
||
olpcMAP.net/json?'''llcenter='''42.356261,-71.05957'''&km-distance='''30 |
|||
Using Yahoo Maps + Where On Earth ID, you can set the center to be almost any placename: |
Using Yahoo Maps + Where On Earth ID, you can set the center to be almost any placename: |
||
olpcMAP.net/json?'''center='''Boston,MA'''&km-distance='''30 |
|||
Using a map marker as the central point: |
Using a map marker as the central point: |
||
olpcMAP.net/json?'''id='''336003'''&km-distance='''600 |
|||
The URL above loads points within 600 kilometres of the map marker at http://olpcMAP.net?id=336003 |
The URL above loads points within 600 kilometres of the map marker at http://olpcMAP.net?id=336003 |
||
Line 20: | Line 20: | ||
Load points within a box (use format north,east,south,west): |
Load points within a box (use format north,east,south,west): |
||
olpcMAP.net/json?'''llregion='''20.38154,-69.579162,17.555734,-74.98993 |
|||
Using Yahoo Maps + Where On Earth ID, you can set the region to almost any placename: |
Using Yahoo Maps + Where On Earth ID, you can set the region to almost any placename: |
||
olpcMAP.net/json?'''region='''Mongolia |
|||
=Request Formats= |
=Request Formats= |
||
Line 32: | Line 33: | ||
Get JavaScript which you can add via <script src="SCRIPT"></script> by adding &format=js |
Get JavaScript which you can add via <script src="SCRIPT"></script> by adding &format=js |
||
olpcMAP.net/json?region=Mongolia'''&format=js''' |
|||
=Data Model= |
=Data Model= |
||
The JSON object has an array of points called '''pts''' |
|||
Each point has these attributes: |
|||
* name - a string with title, person's name, or person's privatized name (for example, Adam Holt may be in the database, but output will be privatized to Adam H) |
|||
* id - a string which can be used to edit markers or access contact information |
|||
** GET http://olpcmap.net/contact?id=359001 for a contact form for this point |
|||
** POST http://olpcmap.net/contacter?id=359001 with variables |
|||
*** login = an e-mail address |
|||
*** message = the message |
|||
** Edit an existing marker by ID |
|||
*** GET http://olpcmap.net/makePoint?id=ID&name=NAME&pt=LAT,LNG&icon=ICON_URL&details=DETAILS&photo=URL&album=URL&group=NAME |
|||
** Create a new marker by not sending an ID variable |
|||
*** GET http://olpcmap.net/makePoint?name=NAME&pt=LAT,LNG&icon=ICON_URL&details=DETAILS&photo=URL&album=URL&group=NAME |
|||
*** this returns JavaScript with the ID of the marker just created: |
|||
*** ''myPoints[sendPtIndex].id="ID_VALUE";'' |
|||
* pt - a array of two decimal numbers with format [ LATITUDE , LONGITUDE ] |
|||
* icon - string URL to the marker's preferred icon. Values such as an empty string or "DEFAULT" can be any icon |
|||
* details - string - text description of this point; may include HTML links, ordered lists, and unordered lists |
|||
* photo - string URL to a photo connected to this marker; empty string means that none is known |
|||
* album - string URL to a photo album connected to this marker; empty string means that none is known |
|||
* group - string with a group name, URL to the group's website, or an empty string if no group was given |
|||
=Feature / Search Requests= |
=Feature / Search Requests= |
Revision as of 16:58, 2 December 2010
Request URLs
Request by Distance from Point
Load points a given distance from a latitude,longitude center with the llcenter variable:
olpcMAP.net/json?llcenter=42.356261,-71.05957&km-distance=30
Using Yahoo Maps + Where On Earth ID, you can set the center to be almost any placename:
olpcMAP.net/json?center=Boston,MA&km-distance=30
Using a map marker as the central point:
olpcMAP.net/json?id=336003&km-distance=600
The URL above loads points within 600 kilometres of the map marker at http://olpcMAP.net?id=336003
Request by Area
Load points within a box (use format north,east,south,west):
olpcMAP.net/json?llregion=20.38154,-69.579162,17.555734,-74.98993
Using Yahoo Maps + Where On Earth ID, you can set the region to almost any placename:
olpcMAP.net/json?region=Mongolia
Request Formats
Data is in JSON by default.
Get JavaScript which you can add via <script src="SCRIPT"></script> by adding &format=js
olpcMAP.net/json?region=Mongolia&format=js
Data Model
The JSON object has an array of points called pts
Each point has these attributes:
- name - a string with title, person's name, or person's privatized name (for example, Adam Holt may be in the database, but output will be privatized to Adam H)
- id - a string which can be used to edit markers or access contact information
- GET http://olpcmap.net/contact?id=359001 for a contact form for this point
- POST http://olpcmap.net/contacter?id=359001 with variables
- login = an e-mail address
- message = the message
- Edit an existing marker by ID
- Create a new marker by not sending an ID variable
- GET http://olpcmap.net/makePoint?name=NAME&pt=LAT,LNG&icon=ICON_URL&details=DETAILS&photo=URL&album=URL&group=NAME
- this returns JavaScript with the ID of the marker just created:
- myPoints[sendPtIndex].id="ID_VALUE";
- Create a new marker by not sending an ID variable
- pt - a array of two decimal numbers with format [ LATITUDE , LONGITUDE ]
- icon - string URL to the marker's preferred icon. Values such as an empty string or "DEFAULT" can be any icon
- details - string - text description of this point; may include HTML links, ordered lists, and unordered lists
- photo - string URL to a photo connected to this marker; empty string means that none is known
- album - string URL to a photo album connected to this marker; empty string means that none is known
- group - string with a group name, URL to the group's website, or an empty string if no group was given