Skip to content

GeoProcessor / Command / ReadGeoLayerFromGeoJSON


Overview

The ReadGeoLayerFromGeoJSON command reads a GeoLayer from a file in GeoJSON format.

The command is able to read original (2008) GeoJSON specification and latest RFC 7946 specification. Therefore, the command can be used with WriteGeoLayerToGeoJSON command to convert a GeoJSON file from old to new specification.

Command Editor

The following dialog is used to edit the command and illustrates the command syntax.

ReadGeoLayerFromGeoJSON

ReadGeoLayerFromGeoJSON Command Editor (see full-size image)

Command Syntax

The command syntax is as follows:

ReadGeoLayerFromGeoJSON(Parameter="Value",...)

Command Parameters

Parameter                      Description Default          
InputFile
required
The GeoJSON file to read (relative or absolute path). ${Property} syntax is recognized. None - must be specified.
GeoLayerID A GeoLayer identifier. Formatting characters and ${Property} syntax is recognized. Refer to documentation for best practices on naming GeoLayer identifiers. The GeoJSON filename without the leading path and without the file extension. (Formatting character %f)
Name Name of the output GeoLayer. NewGeoLayerID
Description Description for the output GeoLayer.
Properties Additional properties to assign to the GeoLayer, using format: prop1:value1,prop2:'string with space'. Can use ${Property} notation. No additional properties are assigned.
IfGeoLayerIDExists The action that occurs if the GeoLayerID already exists within the GeoProcessor:
  • Replace - The existing GeoLayer within the GeoProcessor is replaced with the new GeoLayer. No warning is logged.
  • ReplaceAndWarn - The existing GeoLayer within the GeoProcessor is replaced with the new GeoLayer. A warning is logged.
  • Warn - The new GeoLayer is not created. A warning is logged.
  • Fail - The new GeoLayer is not created. A fail message is logged.
Replace

Examples

See the automated tests.

The following folder, ExampleFolder, and its contents are used for the examples. The ExampleFolder is not an actual existing folder. It is used in this documentation to explain how the ReadGeoLayerFromGeoJSON command interacts with similar, existing folders on your local machine.

ExampleFolder

Filename File Type
ExampleFile1.geojson GeoJSON
ExampleFile2.geojson GeoJSON

Example 1: Read a GeoLayer from a GeoJSON File

ReadGeoLayerFromGeoJSON(InputFile="ExampleFolder/ExampleFile1.geojson")

After running the command, the following GeoLayer IDs are registered within the GeoProcessor.

Registered GeoLayer IDs
ExampleFile1

Example 2: Assign a Unique GeoLayer ID

ReadGeoLayerFromGeoJSON(InputFile="ExampleFolder/ExampleFile1.geojson",GeoLayerID="StateBoundary")

After running the command, the following GeoLayer IDs are registered within the GeoProcessor.

Registered GeoLayer IDs
StateBoundary

Troubleshooting

See Also