new SuperMap.Format.GeoJSON(options)
Name | Type | Description | ||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
Object |
optional
parameter.
|
Extends
Members
-
dataObject
-
When the keepData attribute is set to true, This is the string that is passed to the read operation to be parsed.
-
ignoreExtraDimsboolean
-
Ignore geometry with more than 2 dimensions.
- Default Value: true
indentstring
Format output. For every indent, the indent string will use one time.
- Default Value: " "
keepDataObject
Keep a reference to the data that is read recently (through the attribute). The default value is false
levelinteger
use formatted output, the indentation level is expressed.
nativeJSONboolean
Determine whether browsers are native to support JSON format data.
newlinestring
Format output. newline string will be used for each name value pair or the last number of array.
- Default Value: '\n'
prettyboolean
Whether to use words wrap and indent to control the output.
serialize
A method of providing a number of type objects to a JSON string.
spacestring
Format output. space string wil be added after the name value pair ":".
- Default Value: " "
Methods
-
inherited destroy()
Format.js, line 36 -
Disposes the resource. The property that references resource is set to null.
-
fromGeoJSON(json, type, filter){Object}
GeoJSON.js, line 455 -
Convert a GeoJSON object or a GeoJSON object string to an iServer Feature JSON.
Name Type Default Description json
GeoJSONObject GeoJSON object.
type
string 'FeaureCollection' optional An optional string that determines the format of the output. The supported values are: "Geometry", "Feature", and "FeatureCollection" if this value is null.
filter
function This function is called for each key-value pair at each level in the object to produce a result. Each value is replaced by the result of the filter function. This function can be used to convert some objects into corresponding objects of a class, or to convert a date string into a Date object.
- Version:
- 9.1.1
Returns:
Type Description Object iServer Feature JSON。 -
read(json, filter, type){Object}
GeoJSON.js, line 364 -
Convert a GeoJSON object or a GeoJSON object string to a SuperMap Feature object.
Name Type Default Description json
GeoJSONObject GeoJSON object.
filter
function Optional string. It determines the output format. The supported values are "Geometry","Feature" and "FeatureCollection", If this value is null, it will use default value "FeaureCollection".
type
string 'FeaureCollection' optional An optional string that determines the format of the output. The supported values are: "Geometry", "Feature", and "FeatureCollection" if this value is null.
Returns:
Type Description Object The return value depends on type parameter value.
If type is "FeatureCollection"(Default value), the return value will beSuperMap.Feature.Vector
array.
If type is "Geometry", the input json object must be a unique geometry, and the return value isSuperMap.Feature.Geometry
.
If type is "Feature", the input json object is a feature and the return value isSuperMap.Feature.Vector
. -
toGeoJSON(obj){GeoJSONObject}
GeoJSON.js, line 468 -
Convert an iServer Feature JSON object to a GeoJSON object.
Name Type Description obj
Object iServer Feature JSON。
- Version:
- 9.1.1
Returns:
Type Description GeoJSONObject GeoJSON object. -
write(obj, pretty){GeoJSONObject}
GeoJSON.js, line 445 -
iServer's Geometry JSON object to a GeoJSON object string.
Name Type Default Description obj
Object iServer's Geometry JSON object.
pretty
boolean false optional Whether to use line feed and indentation to control the output.
Returns:
Type Description GeoJSONObject A GeoJSON string that represents the input geometry object, feature object, or array of feature objects.