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

GeoJsonMultiLine serialized to type Line #44

Open
albertoleal19 opened this issue May 11, 2023 · 0 comments
Open

GeoJsonMultiLine serialized to type Line #44

albertoleal19 opened this issue May 11, 2023 · 0 comments

Comments

@albertoleal19
Copy link

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!!

@albertoleal19 albertoleal19 changed the title GeoJsonMultiLine serialized to type Line GeoJsonMultiLine serialized to type Line May 11, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant