Skip to content
This repository was archived by the owner on May 27, 2024. It is now read-only.
This repository was archived by the owner on May 27, 2024. It is now read-only.

GeoJsonMultiLine serialized to type Line #44

Open
@albertoleal19

Description

@albertoleal19

I am new to GeoJson, but I notice that the GeoJsonFeature GeoJsonMultiLine when serialized the value of the Type is Line, however, when parsing a geojson collection that includes as feature with Type Line an exception is throw.

The serialization code is in src/models.dart at line 241:

  /// Serialize to a geojson feature string
  String serializeFeature(Map<String, dynamic>? properties) {
    final geoSeries = <GeoSerie?>[];
    for (final line in lines) {
      geoSeries.add(line.geoSerie);
    }
    return _buildGeoJsonFeature(
        geoSeries, "Line", properties ?? <String, dynamic>{"name": name});
  }

As you can notice, the type value is set to Line.

Looking at the code, in the file src/geojson.dart at line 498:

  case "MultiLineString":
    if (query != null) {
      if (query.geometryType != null) {
        if (query.geometryType != GeoJsonFeatureType.multiline) {
          continue;
        }
      }
    }
    feature = _processGeometry(geometry, properties, nameProperty);
    break;

A case for MultiLineString is evaluated but there is no case for Line type.

So, the questions are:

  • Why serialization of a GeoJson model (GeoJsonMultiLine) would set a type that doesn't fit to the GeoJson specifications, if it is not supported by the library? Is there a different way to generate GeoJson data?
  • Is it a bug? Can it be solved?
  • The generation of GeoJson data is not a recommended use case of this library?

Thanks in advance for your attention to this issue!!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions