feature.Feature()
¶
-
class
feature.
Feature
(config)¶ - Arguments
config (Object) – Configuration object.
Create a new feature.
Example Use¶
Sample code to create a new feature:
>> var Feature = require("geoscript/feature").Feature;
>> var Point = require("geoscript/geom").Point;
>> var city = Feature({
.. properties: {
.. location: Point([-110, 45]),
.. name: "Metropolis"
.. }
.. });
>> city.get("name");
Metropolis
>> city.get("location");
<Point [-110, 45]>
Config Properties¶
-
schema
feature.Schema()
The feature schema. If not provided, a schema will be derived from the providedproperties
in the configuration.
-
properties
Object
An object with all the feature property names and values.
Properties¶
-
Feature.
bounds
¶ geom.Bounds()
The bounds of the default geometry (if any) for this feature. Will beundefined
if the feature has no geometry.
-
Feature.
geometry
¶ geom.Geometry()
The default geometry (if any) for the feature. Will beundefined
if the feature does not have a geometry.
-
Feature.
geometryName
¶ String
Field name for the default geoemtry, orundefined
if the feature has no geometry.
-
Feature.
id
¶ String
The feature identifier. Read only.
-
Feature.
json
¶ String
The JSON representation of the feature (see http://geojson.org).
-
Feature.
projection
¶ proj.Projection()
Optional projection for the feature. This corresponds to the projection of the default geometry for the feature.
-
Feature.
schema
¶ feature.Schema()
The feature schema (read-only).