Table of Contents

Class GeoJSONImportConfig

Namespace
YndigoBlue.Velocity.Model
Assembly
YndigoBlue.Velocity.dll

Controls how a GeoJSON file is mapped onto a database table when imported with ImportGeoJSON(Table, string, GeoJSONImportConfig, bool).

public class GeoJSONImportConfig : ImportConfig
Inheritance
GeoJSONImportConfig

Remarks

Warning

GeoJSON import is not available in the Community Edition of Velocity. It requires the Full Edition.

A GeoJSON Feature has three parts a table can be populated from, and each is mapped separately:

The id has its own mapping because in GeoJSON it is a member of the Feature itself rather than one of its properties, so it cannot be addressed by a property path.

Nested properties are addressed with a dotted path: contact_info.manager reads manager from the object stored under the contact_info property. Paths may be nested to any depth. A path that does not resolve — a missing property, or one whose parent is absent or not an object — imports as null rather than failing, so a feature that omits an optional property is not an error.

Columns the table has but the configuration does not map are left to the database, exactly as in a CSV import: they take their default, or null.

Mapping a feature with nested contact details:
var config = new GeoJSONImportConfig();

config.MapGeometry("location", DataType.Geography);
config.MapId("site_id", DataType.Long);
config.MapProperty("location_name", "name", DataType.VarChar);
config.MapProperty("contact_info.manager", "manager", DataType.VarChar);
config.MapProperty("contact_info.phone", "phone", DataType.VarChar);
config.MapProperty("operating_hours.weekdays", "hours_weekday", DataType.VarChar);

using (var m = new Manager(conn))
{
    m.ImportGeoJSON(sitesTable, "sites.geojson", config);
}

Constructors

GeoJSONImportConfig(DateFormatType)

Initializes a new GeoJSONImportConfig.

Properties

GeometryColumn

Gets the table column the Feature's geometry is written to, or null if it is not mapped.

IdColumn

Gets the table column the Feature's id member is written to, or null if it is not mapped.

Methods

MapGeometry(string, DataType)

Maps the Feature's geometry to a table column.

MapId(string, DataType)

Maps the Feature's top-level id member to a table column.

MapProperty(string, string, DataType)

Maps a property to a table column.