Load GIS document with options

GroupDocs.Conversion provides GisLoadOptions to control how source GIS (Geographic Information System) documents are processed. GIS documents include formats like GeoJSON, KML, 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, Gpx, Kml, 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:

With v24.10 and later:

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);
}

Before v24.10:

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

Func<LoadOptions> getLoadOptions = () => 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:

With v24.10 and later:

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);
}

Before v24.10:

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

Func<LoadOptions> getLoadOptions = () => 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:

With v24.10 and later:

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);
}

Before v24.10:

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

Func<LoadOptions> getLoadOptions = () => 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:

With v24.10 and later:

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);
}

Before v24.10:

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

Func<LoadOptions> getLoadOptions = () => 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:

With v24.10 and later:

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);
}

Before v24.10:

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

Func<LoadOptions> getLoadOptions = () => 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);
}
Close
Loading

Analyzing your prompt, please hold on...

An error occurred while retrieving the results. Please refresh the page and try again.