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.


Parse GeoJSON pipeline

Download this Pipeline
  1. Configure the File Reader Snap to read the GML file

    File Reader Snap reading the GML file

  2. Map content type using the Mapper Snap

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


    Mapper Snap setting the content type

  3. Send Mapper output to GeoJSON Parser Snap

    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.


    GeoJSON Parser Snap parsing the GML input

  4. Write output as a GeoJSON document

    Upon validation, the GeoJSON Parser Snap parses the GML file and writes the contents as a GeoJSON document to its output view.


    GeoJSON output from the parser

  1. Ensure the content type is correctly mapped to application/gml+xml when using GML files.
  2. If using ZIP files containing shapefiles, update the content type to application/zip.
  3. Validate the final output from the GeoJSON Parser Snap before using it in downstream Snaps or tools.