WKT 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 the shapefiles.

 

Overview of settings with default values

 

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 WKT document to its output view.

Prerequisites

  • None.

Support for 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, Snowflake and PostgreSQL are the only supported database Snaps for downstream output.

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

Type

Format

Number of Views

Examples of Upstream and Downstream Snaps

Description

Input 

Binary

  • Min: 1

  • Max: 1

  • File Reader Snap

  • Multi File Reader Snap

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

  • Min: 1

  • Max: 1

  • Mapper

  • File Writer

  • Snowflake

  • PostgreSQL

Output is WKT, which can then be loaded to Snowflake or PostgreSQL databases.

The downstream Snap can be a database Snap that loads the output to a target table.

 

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:

  • Stop Pipeline Execution: Stops the current Pipeline execution if the Snap encounters an error.

  • Discard Error Data and Continue: Ignores the error, discards that record, and continues with the remaining records.

  • Route Error Data to Error View: Routes the error data to an error view without stopping the Snap execution.

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

Field Name

Field Type

Field Dependency

Description

Label*

 

 

Default ValueWKT Parser
ExamplemyWKT 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
Example: GML file

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.
Examplelimit

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: 

  root/folder1/subfolder1/line.shp

Snap Execution

Default ValueExecute only
Example: Validate & Execute

Dropdown list

N/A

Select one of the following three modes in which the Snap executes:

  • Validate & Execute: Performs limited execution of the Snap, and generates a data preview during pipeline validation. Subsequently, performs full execution of the Snap (unlimited records) during pipeline runtime.

  • Execute only: Performs full execution of the Snap during pipeline execution without generating preview data.

  • Disabled: Disables the Snap and all Snaps that are downstream from it.

Troubleshooting

Error

Reason

Resolution

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 shapefiles and load the data in Snowflake

This example pipeline demonstrates how to read shapefiles from the File Reader Snap, map the content type, parse the input, map the data to a Snowflake table, and then load the data to Snowflake.

First, we configure the File Reader Snap to read shapefiles from a ZIP 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/zip because our input is a ZIP file of shapefiles.
(If your input is a GML file, you must update the content type as application/gml+xml; charset=utf-8.)

 

Upon validation, the output from the Mapper Snap is sent to the WKT Parser Snap, which parses the shapefiles.

 

Next, the output from this is sent to the Mapper Snap, where we have mapped the data.

In this example, we’ve mapped the output document to the GEOMETRY column in our Snowflake table.

 

Finally, we configure the Snowflake Snap with our Snaplogic Snowflake Account credentials and specify the Snowflake target schema and table in the Schema Name and Table Name fields.

 

Downloads

  1. Download and import the Pipeline into SnapLogic.

  2. Configure Snap accounts, as applicable.

  3. Provide Pipeline parameters, as applicable.

 

Snap Pack History