- Timestamp:
- Apr 19, 2011, 11:09:59 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/docs/api/zoo-format-geojson.txt
r167 r174 112 112 ZOO.Format.GeoJSON 113 113 Create a new parser for GeoJSON. 114 115 116 *Parameters* 117 118 ``options {Object}`` An optional object whose properties will be set on this instance. 114 119 115 120 .. _read: 116 121 117 122 read 123 :: 124 125 read: function(json,type,filter) 126 118 127 Deserialize a GeoJSON string. 128 129 *Parameters* 130 131 | ``json {String}`` A GeoJSON string 132 | ``type {String}`` Optional string that determines the structure of the output. Supported values are "Geometry", "Feature", and "FeatureCollection". If absent or null, a default of "FeatureCollection" is assumed. 133 | ``filter {Function}`` A function which will be called for every key and value at every level of the final result. Each value will be replaced by the result of the filter function. This can be used to reform generic objects into instances of classes, or to transform date strings into Date objects. 134 135 *Returns* 136 137 ``{Object}`` The return depends on the value of the type argument. If type is "FeatureCollection" (the default), 138 the return will be an array of :ref:`ZOO.Feature <api-zoo-feature>`. If type is "Geometry", the input json must 139 represent a single geometry, and the return will be an :ref:`ZOO.Geometry <api-zoo-geometry>`. If type 140 is "Feature", the input json must represent a single feature, and the return will be an :ref:`ZOO.Feature <api-zoo-feature>`. 119 141 120 142 .. _isValidType: 121 143 122 144 isValidType 145 :: 146 147 isValidType: function(obj,type) 148 123 149 Check if a GeoJSON object is a valid representative of the given type. 150 151 *Returns* 152 153 ``{Boolean}`` The object is valid GeoJSON object of the given type. 124 154 125 155 .. _parseFeature: 126 156 127 157 parseFeature 128 Convert a feature object from GeoJSON into an ZOO.Feature. 158 :: 159 160 parseFeature: function(obj) 161 162 Convert a feature object from GeoJSON into a :ref:`ZOO.Feature <api-zoo-feature>`. 163 164 *Parameters* 165 166 ``obj {Object}`` An object created from a GeoJSON object 167 168 *Returns* 169 170 :ref:`{ZOO.Feature} <api-zoo-feature>` A feature. 129 171 130 172 .. _parseGeometry: 131 173 132 174 parseGeometry 133 Convert a geometry object from GeoJSON into an ZOO.Geometry. 175 :: 176 177 parseGeometry: function(obj) 178 179 Convert a geometry object from GeoJSON into a :ref:`ZOO.Geometry <api-zoo-geometry>`. 180 181 *Parameters* 182 183 ``obj {Object}`` An object created from a GeoJSON object 184 185 *Returns* 186 187 :ref:`{ZOO.Geometry} <api-zoo-geometry>` A geometry. 134 188 135 189 **parseCoords Properties** … … 138 192 139 193 parseCoords 140 Object with properties corresponding to the GeoJSON geometry types. 194 Object with properties corresponding to the GeoJSON geometry types. Property 195 values are functions that do the actual parsing. 141 196 142 197 **parseCoords Functions** … … 145 200 146 201 parseCoords.point 147 Convert a coordinate array from GeoJSON into an ZOO.Geometry.Point. 202 Convert a coordinate array from GeoJSON into a :ref:`ZOO.Geometry.Point <api-zoo-geometry-point>`. 203 204 *Parameters* 205 206 ``array {Object}`` The coordinates array from the GeoJSON fragment. 207 208 *Returns* 209 210 :ref:`{ZOO.Geometry.Point} <api-zoo-geometry-point>` A geometry. 148 211 149 212 .. _parseCoords.multipoint: 150 213 151 214 parseCoords.multipoint 152 Convert a coordinate array from GeoJSON into an ZOO.Geometry.MultiPoint. 215 Convert a coordinate array from GeoJSON into a :ref:`ZOO.Geometry.MultiPoint <api-zoo-geometry-multipoint>`. 216 217 *Parameters* 218 219 ``array {Object}`` The coordinates array from the GeoJSON fragment. 220 221 *Returns* 222 223 :ref:`{ZOO.Geometry.MultiPoint} <api-zoo-geometry-multipoint>` A geometry. 153 224 154 225 .. _parseCoords.linestring: 155 226 156 227 parseCoords.linestring 157 Convert a coordinate array from GeoJSON into an ZOO.Geometry.LineString. 228 Convert a coordinate array from GeoJSON into a :ref:`ZOO.Geometry.LineString <api-zoo-geometry-linestring>`. 229 230 *Parameters* 231 232 ``array {Object}`` The coordinates array from the GeoJSON fragment. 233 234 *Returns* 235 236 :ref:`{ZOO.Geometry.LineString} <api-zoo-geometry-linestring>` A geometry. 158 237 159 238 .. _parseCoords.multilinestring: 160 239 161 240 parseCoords.multilinestring 162 Convert a coordinate array from GeoJSON into an ZOO.Geometry.MultiLineString. 241 Convert a coordinate array from GeoJSON into a :ref:`ZOO.Geometry.MultiLineString <api-zoo-geometry-multilinestring>`. 242 243 *Parameters* 244 245 ``array {Object}`` The coordinates array from the GeoJSON fragment. 246 247 *Returns* 248 249 :ref:`{ZOO.Geometry.MultiLineString} <api-zoo-geometry-multilinestring>` A geometry. 163 250 164 251 .. _parseCoords.polygon: 165 252 166 253 parseCoords.polygon 167 Convert a coordinate array from GeoJSON into an ZOO.Geometry.Polygon. 168 254 Convert a coordinate array from GeoJSON into a :ref:`ZOO.Geometry.Polygon <api-zoo-geometry-polygon>`. 255 256 *Parameters* 257 258 ``array {Object}`` The coordinates array from the GeoJSON fragment. 259 260 *Returns* 261 262 :ref:`{ZOO.Geometry.Polygon} <api-zoo-geometry-polygon>` A geometry. 263 169 264 .. _parseCoords.multipolygon: 170 265 171 266 parseCoords.multipolygon 172 Convert a coordinate array from GeoJSON into an ZOO.Geometry.MultiPolygon. 267 Convert a coordinate array from GeoJSON into a :ref:`ZOO.Geometry.MultiPolygon <api-zoo-geometry-multipolygon>`. 268 269 *Parameters* 270 271 ``array {Object}`` The coordinates array from the GeoJSON fragment. 272 273 *Returns* 274 275 :ref:`{ZOO.Geometry.MultiPolygon} <api-zoo-geometry-multipolygon>` A geometry. 173 276 174 277 .. _parseCoords.box: 175 278 176 279 parseCoords.box 177 Convert a coordinate array from GeoJSON into an ZOO.Geometry.Polygon. 280 Convert a coordinate array from GeoJSON into a :ref:`ZOO.Geometry.Polygon <api-zoo-geometry-polygon>`. 281 282 *Parameters* 283 284 ``array {Object}`` The coordinates array from the GeoJSON fragment. 285 286 *Returns* 287 288 :ref:`{ZOO.Geometry.Polygon} <api-zoo-geometry-polygon>` A geometry. 178 289 179 290 .. _write: 180 291 181 292 write 293 :: 294 295 write: function(obj,pretty) 296 182 297 Serialize a feature, geometry, array of features into a GeoJSON string. 298 299 *Parameters* 300 301 | ``obj {Object}`` A :ref:`{ZOO.Feature} <api-zoo-feature>`, :ref:`{ZOO.Geometry} <api-zoo-geometry>`, or an array of features. 302 | ``pretty {Boolean}`` Structure the output with newlines and indentation. Default is false. 303 304 *Returns* 305 306 ``{String}`` The GeoJSON string representation of the input geometry, features, or array of features. 183 307 184 308 .. _createCRSObject: 185 309 186 310 createCRSObject 311 :: 312 313 createCRSObject: function(object) 314 187 315 Create the CRS object for an object. 188 316 317 *Parameters* 318 319 ``object`` :ref:`{ZOO.Feature} <api-zoo-feature>` 320 321 *Returns* 322 323 ``{Object}`` An object which can be assigned to the crs property of a GeoJSON object. 324 189 325 **extract Properties** 190 326 … … 192 328 193 329 extract 194 Object with properties corresponding to the GeoJSON types. 330 Object with properties corresponding to the GeoJSON types. Property values are 331 functions that do the actual value extraction. 195 332 196 333 **extract Functions** … … 200 337 extract.feature 201 338 Return a partial GeoJSON object representing a single feature. 339 340 341 *Parameters* 342 343 ``feature`` :ref:`{ZOO.Feature} <api-zoo-feature>` 344 345 *Returns* 346 347 ``{Object}`` An object representing the point. 202 348 203 349 .. _extract.geometry: … … 205 351 extract.geometry 206 352 Return a GeoJSON object representing a single geometry. 353 354 *Parameters* 355 356 ``geometry`` :ref:`{ZOO.Geometry} <api-zoo-geometry>` 357 358 *Returns* 359 360 ``{Object}`` An object representing the geometry. 207 361 208 362 .. _extract.point: … … 210 364 extract.point 211 365 Return an array of coordinates from a point. 366 367 *Parameters* 368 369 ``point`` :ref:`{ZOO.Geometry.Point} <api-zoo-geometry-point>` 370 371 *Returns* 372 373 ``{Array}`` An array of coordinates representing the point. 212 374 213 375 .. _extract.multipoint: … … 215 377 extract.multipoint 216 378 Return an array of coordinates from a multipoint. 379 380 *Parameters* 381 382 ``multipoint`` :ref:`{ZOO.Geometry.MultiPoint} <api-zoo-geometry-multipoint>` 383 384 *Returns* 385 386 ``{Array}`` An array of point coordinate arrays representing the multipoint. 217 387 218 388 .. _extract.linestring: … … 220 390 extract.linestring 221 391 Return an array of coordinate arrays from a linestring. 392 393 *Parameters* 394 395 ``linestring`` :ref:`{ZOO.Geometry.LineString} <api-zoo-geometry-linestring>` 396 397 *Returns* 398 399 ``{Array}`` An array of coordinate arrays representing the linestring. 222 400 223 401 .. _extract.multilinestring: … … 225 403 extract.multilinestring 226 404 Return an array of linestring arrays from a linestring. 405 406 *Parameters* 407 408 ``multilinestring`` :ref:`{ZOO.Geometry.MultiLineString} <api-zoo-geometry-multilinestring>` 409 410 *Returns* 411 412 ``{Array}`` An array of linestring arrays representing the multilinestring. 227 413 228 414 .. _extract.polygon: … … 230 416 extract.polygon 231 417 Return an array of linear ring arrays from a polygon. 418 419 *Parameters* 420 421 ``polygon`` :ref:`{ZOO.Geometry.Polygon} <api-zoo-geometry-polygon>` 422 423 *Returns* 424 425 ``{Array}`` An array of linear ring arrays representing the polygon. 232 426 233 427 .. _extract.multipolygon: … … 236 430 Return an array of polygon arrays from a multipolygon. 237 431 432 *Parameters* 433 434 ``multipolygon`` :ref:`{ZOO.Geometry.MultiPolygon} <api-zoo-geometry-multipolygon>` 435 436 *Returns* 437 438 ``{Array}`` An array of polygon arrays representing the multipolygon 439 238 440 .. _extract.collection: 239 441 240 442 extract.collection 241 443 Return an array of geometries from a geometry collection. 444 445 *Parameters* 446 447 ``collection`` :ref:`{ZOO.Geometry.Collection} <api-zoo-geometry-collection>` 448 449 *Returns* 450 451 ``{Array}`` An array of geometry objects representing the geometry collection.
Note: See TracChangeset
for help on using the changeset viewer.