Project

General

Profile

Statistics
| Revision:

root / trunk / web / dojo / dojox / rpc / SMDLibrary / geonames.smd @ 12

History | View | Annotate | Download (9.27 KB)

1 9 andrej.cim
{
2
3
	// JSON REST services provided by geonames.org
4
	// adapted from: http://www.geonames.org/export/JSON-webservices.html
5
	// http://creativecommons.org/licenses/by/3.0/
6
	// INCOMPLETE IMPLEMENTATION
7
8
	"SMDVersion":"2.0",
9
	"id":"/geonames",
10
	"transport":"JSONP",
11
	"envelope":"URL",
12
	"target": "http://ws.geonames.org/",
13
14
	"parameters" : [
15
		{name:"type", optional: false, "default":"JSON"}
16
	],
17
18
	"services":{
19
		getCountryInfo:{
20
			// Result : returns info about a country such as name, population, etc.
21
			// If country parameter is not specified, that information is returned for
22
			// every country
23
			"target": "countryInfoJSON",
24
			"parameters": [
25
				{ name: "country", type:"STRING", optional: true },
26
				{ name: "lang", type:"STRING"}, // default: "en"
27
				{ name: "maxRows", type:"INTEGER", optional: true } // default: 10
28
			]
29
		},
30
31
		getCities:{
32
			// Result : returns a list of cities and placenames in the bounding box,
33
			// ordered by relevancy (capital/population). Placenames close together
34
			// are filterered out and only the larger name is included in the resulting list.
35
			"target": "citiesJSON",
36
			"parameters": [
37
				{ name: "north", type:"FLOAT"},
38
				{ name: "south", type:"FLOAT"},
39
				{ name: "east", type:"FLOAT"},
40
				{ name: "west", type:"FLOAT"},
41
				{ name: "lang", type:"STRING"}, // default: "en"
42
				{ name: "maxRows", type:"INTEGER", optional: true } // deault: 10
43
			]
44
		},
45
46
		"getQuakes":{
47
			// Result : returns a list of earthquakes, ordered by magnitude
48
			"target" : "earthquakesJSON",
49
			"parameters" : [
50
				// bounding box coords:
51
				{ name: "north", type:"FLOAT" },
52
				{ name: "south", type:"FLOAT" },
53
				{ name: "east", type:"FLOAT" },
54
       				{ name: "west", type:"FLOAT" },
55
				{ name: "date", type:"STRING",optional: true }, // yyyy-MM-dd
56
				{ name: "minMagniture", type:"INTERGER",optional: true },
57
				{ name: "maxRows", type:"INTEGER", optional: true } // deault: 10
58
			]
59
		},
60
61
		"getWeather":{
62
			// Weather data is provided in the METAR (METeorological Aerodrome Report) format.
63
			// Result : returns a list of weather stations with the most recent weather observation
64
			"target" : "weatherJSON",
65
			"parameters" : [
66
				{ name: "north", type:"FLOAT" },
67
				{ name: "south", type:"FLOAT" },
68
				{ name: "east", type:"FLOAT" },
69
				{ name: "west", type:"FLOAT" },
70
				{ name: "maxRows", type:"INTEGER",optional:true } // deault: 10
71
			]
72
		},
73
74
		"getWeatherByICAO":{
75
			// Result : returns the weather station and the most recent weather observation for the ICAO code
76
			"target": "weatherIcaoJSON",
77
			"parameters": [
78
				{ name:"ICAO", type:"STRING" }
79
			]
80
		},
81
82
		"getWeatherByCoords":{
83
			// Result : returns a weather station with the most recent weather observation
84
			"target": "findNearByWeatherJSON",
85
			"parameters": [
86
				{ name:"lat", type:"FLOAT" },
87
				{ name:"lng", type:"FLOAT" }
88
			]
89
		},
90
91
		"getChildren":{
92
                        // Returns the children for a given geonameId. The children are the
93
                        // administrative divisions within an other administrative division.
94
                        // Like the counties (ADM2) in a state (ADM1) or also the countries
95
                        // in a continent.
96
                        "target": "childrenJSON",
97
			"parameters": [
98
				{ name:"geonameId", type:"INTEGER" }
99
			]
100
		},
101
102
		"getHierarchy":{
103
			// Result : returns a list of GeoName records, ordered by hierarchy
104
			// level. The top hierarchy (continent) is the first element in the list
105
			"target": "hierarchyJSON",
106
			"parameters": [
107
				{ name:"geonameId", type:"INTEGER" }
108
			]
109
		},
110
111
		"getNeighbours":{
112
			// The neighbourhood for US cities. Data provided by Zillow under cc-by-sa license.
113
			"target":"neighboursJSON",
114
			"parameters": [
115
				{ name:"geonameId", type:"INTEGER" }
116
                                //{ name:"lat", type:"FLOAT" },
117
                                //{ name:"long", type:"FLOAT" }
118
			]
119
		},
120
121
		"getNeighbourhood":{
122
			// returns the neighbourhood for the given latitude/longitude
123
			// Example http://ws.geonames.org/neighbourhood?lat=40.78343&lng=-73.96625
124
			"target":"neighbourhoodJSON",
125
			"parameters":[
126
				{ name:"lat", type:"FLOAT" },
127
				{ name:"lng", type:"FLOAT" },
128
				{ name:"radius", type:"FLOAT" }
129
			]
130
		},
131
132
		"getSiblings":{
133
			// Result : returns a list of GeoNames records that have the same
134
			// administrative level and the same father
135
			"target":"siblingsJSON",
136
			"parameters": [
137
				{ name:"geonameId", type:"INTEGER" }
138
			]
139
		},
140
141
		"getCountryCode":{
142
			// returns the iso country code for the given latitude/longitude
143
			// With the parameter type=xml this service returns an xml document
144
			//      with iso country code and country name. The optional parameter
145
			//      lang can be used to specify the language the country name should
146
			//      be in. JSON output is produced with type=JSON
147
			"target":"countryCode",
148
			"parameters": [
149
				{ name:"lat", type:"FLOAT" },
150
				{ name:"lng", type:"FLOAT" },
151
				{ name:"lang", type:"STRING",optional:true },
152
				{ name:"radius", type:"FLOAT" }
153
			]
154
		},
155
156
		"getCountrySubdivision":{
157
			// returns the country and the administrative subdivison (state, province,...) for the given latitude/longitude
158
			// Example http://ws.geonames.org/countrySubdivisionJSON?lat=47.03&lng=10.2
159
			"target":"countrySubdivisionJSON",
160
			"parameters":[
161
				{ name:"lat", type:"FLOAT" },
162
				{ name:"long", type:"FLOAT" },
163
				{ name:"radius", type:"FLOAT" }
164
			]
165
                },
166
167
		"getWikipediaBoundingBox":{
168
			// returns the wikipedia entries within the bounding box as xml document
169
			// Example http://ws.geonames.org/wikipediaBoundingBoxJSON?north=44.1&south=-9.9&east=-22.4&west=55.2
170
			"target":"wikipediaBoundingBoxJSON",
171
			"parameters":[
172
				{ name: "north", type:"FLOAT" },
173
				{ name: "south", type:"FLOAT" },
174
				{ name: "east", type:"FLOAT" },
175
				{ name: "west", type:"FLOAT" },
176
				{ name: "lang", type:"STRING",optional:true }, // default: "en"
177
				{ name: "maxRows", type:"INTEGER",optional:true } // default: 10
178
                        ]
179
                },
180
181
		"searchWikipedia":{
182
			// returns the wikipedia entries found for the searchterm as xml document
183
			// Example http://ws.geonames.org/wikipediaSearchJSON?q=london&maxRows=10
184
			"target":"wikipediaSearchJSON",
185
			"parameters":[
186
				{ name: "q", type:"STRING" }, // place name?
187
				{ name: "title", type:"STRING" }, // optional
188
				{ name: "lang", type:"FLOAT",optional:true }, // de or en
189
				{ name: "maxRows", type:"INTEGER",optional:true } // default: 10
190
			]
191
		},
192
193
		"getTimezone":{
194
                        // the timezone at the lat/lng with gmt offset (1. January) and dst offset (1. July)
195
                        "target":"timezoneJSON",
196
			"parameters":[
197
				{ name:"lat", type:"FLOAT" },
198
				{ name:"lng", type:"FLOAT" }
199
			]
200
		},
201
202
		"search":{
203
                        // returns the names found for the searchterm as xml or json document,
204
                        // the search is using an AND operator
205
                        "target":"searchJSON",
206
			"parameters":[
207
                                // exhaustive list. see: http://www.geonames.org/export/geonames-search.html
208
				{ name:"q", type:"STRING" },
209
				{ name:"name", type:"STRING" },
210
				{ name:"name_equals", type:"STRING" },
211
				// optional:
212
				{ name:"maxRows", type:"INTEGER",optional:true }, // def: 100, max:1000
213
				{ name:"startRow", type:"INTEGER",optional:true }, // def: 0
214
				{ name:"country", type:"STRING",optional:true }, // iso-3166, def: all
215
				/* name:"adminCode..." */
216
				{ name:"featureClass", type:"STRING",optional:true}, // ? multi, enum(a,h,l,p,r,s,t,u,v)
217
				{ name:"featureCode", type:"STRING",optional:true},
218
				{ name:"lang", type:"STRING",optional:true}, // iso-636
219
				{ name:"type", type:"STRING",optional:true}, // xml | json | rdf, def: xml
220
				{ name:"style", type:"STRING",optional:true }, // SHORT,MEDIUM,LONG,FULL def: MEDIUM
221
				{ name:"isNamedRequired", type:"BOOLEAN", optional:true }
222
			]
223
		},
224
225
		"postalCodeLookup":{
226
			// returns a list of places for the given postalcode in JSON format
227
			// Example http://ws.geonames.org/postalCodeLookupJSON?postalcode=6600&country=AT
228
			"target":"postalCodeLookupJSON",
229
			"parameters":[
230
				{ name:"postalcode", type:"STRING" },
231
				{ name:"country", type:"STRING",optional:true},
232
				{ name:"maxRows", type:"INTEGER", optional:true }, // def: 20
233
				{ name:"charset", type:"STRING",optional:true } // def: utf-8
234
			]
235
		},
236
237
                "postalCodeSearch":{
238
                        "target":"postalCodeSearchJSON",
239
			"parameters":[
240
				{ name:"postalcode", type:"STRING",optional:true}, // one or the other
241
				{ name:"placename", type:"STRING",optional:true }, // one or the other
242
				{ name:"country", type:"STRING",optional:true},
243
				{ name:"style", type:"STRING",optional:true}, // def: MEDIUM
244
				{ name:"maxRows", type:"INTEGER",optional:true}, // def: 20
245
                                { name:"charset", type:"STRING",optional:true} // def: utf-8
246
                        ]
247
                }
248
249
                // TODO: implement:
250
                // findNearby,
251
                // findNearbyPlaceName
252
                // findNearbyPostalCodes,
253
                // findNearbyStreets,
254
                // findNearByWeather
255
                // findNearByWikipedia
256
                // findNeareastAddress
257
                // findNearestInterestion
258
                // get
259
                // gtop30
260
                // srtm3
261
262
	} // end services
263
}