GeoJSON Input Transformer
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.
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.
{ "type": "LineString", "coordinates": [ [100.0, 0.0], [101.0, 1.0] ] }
The following sample will create a valid metacard.
{ "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-type | application/json |
id | geojson |
Implementation Details
Exported Services
Registered Interface | Service Property | Value |
---|---|---|
ddf.catalog.transform.InputTransformer | mime-type | application/json |
id | geojson |
Known Issues / Limitations
Does not handle multiple geometries yet.