Skip to end of metadata
Go to start of metadata

You are viewing an old version of this content. View the current version.

Compare with Current View Version History

Version 1 Current »

Description

The GeoJSON Input Transformer is responsible for translating specific GeoJSON into a Catalog Metacard. 

Usage

Using the REST Endpoint, for example, HTTP POST a GeoJSON Metacard to the Catalog.  Once the REST Endpoint receives the GeoJSON Metacard, it is converted to a Catalog Metacard.  

Example HTTP POST of a local metacard.json file using the Curl Command
curl -X POST -i -H "Content-Type: application/json" -d "@metacard.json" http://localhost:8181/services/catalog

 

Conversion

A GeoJSON object consists of a single JSON object. The single JSON object can be a geometry, a Feature, or a FeatureCollection. This input transformer only converts "Feature" objects into metacards. This is a natural choice since Feature objects include geometry information and a list of properties. For instance, if only a geometry object is passed such as only a LineString, that is not enough information to create a metacard. This input transformer currently does not handle FeatureCollections either, but could be supported in the future.

Cannot create Metacard from this limited GeoJSON
 { "type": "LineString",
  "coordinates": [ [100.0, 0.0], [101.0, 1.0] ]
  }

The following sample will create a valid metacard.

Sample Parseable GeoJson (Point)
{
    "properties": {
        "title": "myTitle",
        "thumbnail": "CA==",
        "resource-uri": "http://example.com",
        "created": "2012-09-01T00:09:19.368+0000",
        "metadata-content-type-version": "myVersion",
        "metadata-content-type": "myType",
        "metadata": "<xml></xml>",
        "modified": "2012-09-01T00:09:19.368+0000"
    },
    "type": "Feature",
    "geometry": {
        "type": "Point",
        "coordinates": [
            30.0,
            10.0
        ]
    }
} 

In the current implementation, Metacard.LOCATION is not taken from the properties list as WKT, but instead interpreted from the geometry JSON object. The geometry object is formatted according to the GeoJSON standard. Dates are in the ISO 8601 standard. Whitespace is ignored as in most cases with JSON. Binary data is accepted as Base64. XML must be properly escaped such as what is proper for normal JSON. 

Only Required Attributes are recognized in the properties currently.

 

Metacard Extensibility

GeoJSON Input Transformer supports custom, extensible properties on the incoming GeoJSON.  It uses DDF's extensible metacard support to do this.  To have those customized attributes understood by the system, a corresponding MetacardType must be registered with the MetacardTypeRegistry.  That MetacardType must be specified by name in the metacard-type property of the incoming GeoJSON. If a MetacardType is specified on the GeoJSON input, the customized properties can be processed, cataloged, and indexed. 

{
    "properties": {
        "title": "myTitle",
        "thumbnail": "CA==",
        "resource-uri": "http://example.com",
        "created": "2012-09-01T00:09:19.368+0000",
        "metadata-content-type-version": "myVersion",
        "metadata-content-type": "myType",
        "metadata": "<xml></xml>",
        "modified": "2012-09-01T00:09:19.368+0000",
		"min-frequency": "10000000", 
        "max-frequency": "20000000", 
		"metacard-type": "ddf.metacard.custom.type"
 },
    "type": "Feature",
    "geometry": {
        "type": "Point",
        "coordinates": [
            30.0,
            10.0
        ]
    }
} 

When the GeoJSON Input Transformer gets GeoJSON with the MetacardType specified, it will perform a lookoup in the MetacardTypeRegistry to obtain the specified MetacardType in order to understand how to parse the GeoJSON.  If no MetacardType is specified, the GeoJSON Input Transformer will assume the default MetacardType.  If an unregistered MetacardType is specified, an exception will be returned to the client indicating that the MetacardType was not found.

Installation and Uninstallation

Install the catalog-rest-endpoint feature using the Web Console or System Console.

Configuration

None

Packaging Details

Feature Information

N/A

Included Bundles

N/A

Services

Exported Services

ddf.catalog.transform.InputTransformer
mime-typeapplication/json
idgeojson

Implementation Details

Exported Services

Registered InterfaceService PropertyValue
ddf.catalog.transform.InputTransformermime-typeapplication/json
idgeojson

Known Issues / Limitations

Does not handle multiple geometries yet.

  • No labels