Load GIS document with options

View as MarkdownMarkdown

Set up your AI agent

Give your coding agent live access to the GroupDocs documentation and API reference through the GroupDocs Docs MCP server — no install, no API key. Learn more

claude mcp add --transport http groupdocs-docs https://docs.groupdocs.com/mcp

Also process documents locally

The GroupDocs.Conversion MCP server lets your agent work with files on your machine; they are never uploaded. It needs the .NET 10 SDK or Docker.

claude mcp add groupdocs-conversion -- dnx GroupDocs.Conversion.Mcp --yes
Folders, licensing and more →

GroupDocs.Conversion provides GisLoadOptions to control how source GIS (Geographic Information System) documents are processed. GIS documents include formats like GeoJSON, GeoJSON Text Sequence, KML, KMZ, GPX, and other geospatial data files.

The following options are available:

OptionDescription
FormatThe document type is auto-detected during loading, but you can explicitly specify the source format. Available options include: GeoJson, GeoJsonSeq, Gpx, Kml, Kmz, Osm, TopoJson, Gml
WidthSets the desired page width (in pixels) for rendering the GIS document. Default value is 1000.
HeightSets the desired page height (in pixels) for rendering the GIS document. Default value is 1000.

Load GeoJSON document

The following code snippet shows how to load a GeoJSON document with explicit format specification:

using GroupDocs.Conversion;
using GroupDocs.Conversion.FileTypes;
using GroupDocs.Conversion.Options.Convert;
using GroupDocs.Conversion.Options.Load;

Func<LoadContext, LoadOptions> getLoadOptions = loadContext => new GisLoadOptions
{
    Format = GisFileType.GeoJson
};

using (Converter converter = new Converter("map-data.geojson", getLoadOptions))
{
    PdfConvertOptions options = new PdfConvertOptions();
    converter.Convert("map-data.pdf", options);
}

Load GPX document

The following code snippet shows how to load a GPX (GPS Exchange Format) document:

using GroupDocs.Conversion;
using GroupDocs.Conversion.FileTypes;
using GroupDocs.Conversion.Options.Convert;
using GroupDocs.Conversion.Options.Load;

Func<LoadContext, LoadOptions> getLoadOptions = loadContext => new GisLoadOptions
{
    Format = GisFileType.Gpx
};

using (Converter converter = new Converter("route-tracking.gpx", getLoadOptions))
{
    PdfConvertOptions options = new PdfConvertOptions();
    converter.Convert("route-tracking.pdf", options);
}

Load GIS document with custom dimensions

The following code snippet shows how to load a GeoJSON document and set custom rendering dimensions:

using GroupDocs.Conversion;
using GroupDocs.Conversion.FileTypes;
using GroupDocs.Conversion.Options.Convert;
using GroupDocs.Conversion.Options.Load;

Func<LoadContext, LoadOptions> getLoadOptions = loadContext => new GisLoadOptions
{
    Format = GisFileType.GeoJson,
    Width = 1500,
    Height = 1200
};

using (Converter converter = new Converter("city-boundaries.geojson", getLoadOptions))
{
    PdfConvertOptions options = new PdfConvertOptions();
    converter.Convert("city-boundaries.pdf", options);
}

Convert GIS document to image

The following code snippet shows how to load a GeoJSON document and convert it to an image with custom dimensions:

using GroupDocs.Conversion;
using GroupDocs.Conversion.FileTypes;
using GroupDocs.Conversion.Options.Convert;
using GroupDocs.Conversion.Options.Load;

Func<LoadContext, LoadOptions> getLoadOptions = loadContext => new GisLoadOptions
{
    Format = GisFileType.GeoJson,
    Width = 800,
    Height = 600
};

using (Converter converter = new Converter("region-map.geojson", getLoadOptions))
{
    ImageConvertOptions options = new ImageConvertOptions
    {
        Format = ImageFileType.Png
    };
    converter.Convert("region-map.png", options);
}

Convert between GIS formats

The following code snippet shows how to convert from GPX to KML format:

using GroupDocs.Conversion;
using GroupDocs.Conversion.FileTypes;
using GroupDocs.Conversion.Options.Convert;
using GroupDocs.Conversion.Options.Load;

Func<LoadContext, LoadOptions> getLoadOptions = loadContext => new GisLoadOptions
{
    Format = GisFileType.Gpx
};

using (Converter converter = new Converter("hiking-trail.gpx", getLoadOptions))
{
    GisConvertOptions options = new GisConvertOptions
    {
        Format = GisFileType.Kml
    };
    converter.Convert("hiking-trail.kml", options);
}