GeoJSON Parser
Â
In this article
Overview
You can use this Snap to parse geospatial data from a GML file or from a ZIP file that contains shapefiles.
Snap Type
This Snap is a Parse-type Snap that parses geospatial files. This Snap reads a file binary input stream from its input view and then parses and writes the contents as a GeoJSON document to its output view.
Support for Ultra Pipelines
Works in Ultra Pipelines.Â
Limitations
This Snap requires an upstream File Reader Snap or Multi File Reader Snap that reads the input files from a GML file or from a ZIP file that contains shapefiles (.shp). The File Reader Snap or Multi File Reader Snap must appear immediately before this Snap in the pipeline. Currently, only GML v3 is supported. Also, GeoJSON output is not supported as downstream output for any database Snaps.
Known Issues
This Snap accepts only application/zip
or application/gml+xml; charset=utf-8
as a file input stream. However, the output content type from the File Reader Snap is binary/octet
when the input file is read from SLDB.
Workaround: To read an input file (ZIP or GML) from SLDB, use the Mapper Snap to change the content type from binary/octet
to one of the following:
ZIP file: Change the content type to
application/zip
.GML file: Change the content type to
application/gml+xml; charset=utf-8
.
Snap Views
Type | Format | Number of Views | Examples of Upstream and Downstream Snaps | Description |
---|---|---|---|---|
Input | Binary |
|
| This Snap requires an upstream File Reader Snap or Multi File Reader Snap (immediately preceding it in the pipeline) that reads the input files from a ZIP file that contains shapefiles (.shp).or a single GML file. |
Output | Document |
|
| Output is GeoJSON, which can then be used for any geospatial analytics or map applications. Â Â |
Error | Error handling is a generic way to handle errors without losing data or failing the Snap execution. You can handle the errors that the Snap might encounter when running the Pipeline by choosing one of the following options from the When errors occur list under the Views tab:
Learn more about Error handling in Pipelines. |
Snap Settings
Asterisk ( * ): Indicates a mandatory field.
Suggestion icon (): Indicates a list that is dynamically populated based on the configuration.
Expression icon ( ): Indicates the value is an expression (if enabled) or a static value (if disabled). Learn more about Using Expressions in SnapLogic.
Add icon ( ): Indicates that you can add fields in the field set.
Remove icon ( ): Indicates that you can remove fields from the field set.
Upload icon ( ): Indicates that you can upload files.
Field Name | Field Type | Field Dependency | Description | |
---|---|---|---|---|
Label* Â Default Value:Â GeoJSON Parser | String | None. | Specify a unique name, especially if you have more than one of the same Snap in your pipeline. Â | |
Input format   Default Value: Shapefiles | Dropdown list | None. | Select the format of the file used in the upstream file reader. | |
Read all files | Checkbox | Appears when you select Shapefiles as the Input format. Â | Read all the files in the zip file. | |
Shapefiles | List all the shapefiles to be parsed. Click the plus icon ( ) to add a new shapefile. | |||
Shapefile path  Default value: None. | String/Expression | None. | Specify the path to the shapefile you want to parse. The path should include all folders to the file from the root directory. This property is a URL path to the directory where files will be searched. The expected syntax is:  | |
Snap Execution Default Value:Â Execute only | Dropdown list | N/A | Select one of the following three modes in which the Snap executes:
|
Troubleshooting
Error | Reason | Resolution |
---|---|---|
Unsupported file format. | File format is not supported. | Check if the file provided is a zip file containing a .shp file. |
Shapefile not found. | No shape file found at the root of the zip file. | Check if the shape file is at the root of the zip file. If not, provide the path of the shapefile in the zip file. |
Examples
Read a GML file and parse the input as GeoJSON output
This example pipeline demonstrates how to read a GML file from the File Reader Snap, map the content type, and then parse the input as GeoJSON output.
First, we configure the File Reader Snap to read the GML file.
Next, we add a Mapper Snap to map the content type because the input file resides in SLDB. This step is only needed for input files that reside in SLDB.
In this example, we’ve mapped the content type to application/gml+xml; charset=utf-8
because our input is a GML file.
(If your input is a ZIP file of shapefiles, you must update the content type as application/zip
.)
Upon validation, the output from the Mapper Snap is sent to the GeoJSON Parser Snap, which parses the GML file.
We configured the GeoJSON Parser Snap to read a GML file as input.
Upon validation, the GeoJSON Parser Snap parses the GML file and writes the contents as a GeoJSON document to its output view.
The GeoJSON output can be used to create visual data in analytics or map applications.
You can write this file as a GeoJSON file to use with online analytics tools.
Â
Downloads
Download and import the pipeline into SnapLogic.
Configure Snap accounts, as applicable.
Provide pipeline parameters, as applicable.
Â
Snap Pack History
Related Content
Â
Have feedback? Email documentation@snaplogic.com | Ask a question in the SnapLogic Community
© 2017-2024 SnapLogic, Inc.