synw / map_controller

Stateful map controller for Flutter Map
MIT License
56 stars 61 forks source link

geojson not working #18

Open 4F2E4A2E opened 4 years ago

4F2E4A2E commented 4 years ago

Hello there, I am being able to get some geojson to run on flutter_map.

Since isolate is gone on dart2 for web and there is no other alternative form dart, I am trying to get your geojson example to run with the config: noIsolate: true [1].

Here is the log from a web run on the example:

Launching lib/main.dart on Chrome in debug mode...
Syncing files to device Chrome...
Debug service listening on ws://127.0.0.1:51030/qpXF4lT_5lk=
Debug service listening on ws://127.0.0.1:51030/qpXF4lT_5lk=
Loading geojson data
From geojson {"type":"FeatureCollection","features":[{"type":"Feature","properties":{"scalerank":9,"type":"small","name":"Sahnewal","abbrev": [..]
FEAT SINK Instance of 'GeoJsonFeature<GeoJsonPoint>' / GeoJsonFeatureType.point
[..]
FEAT SINK Instance of 'GeoJsonFeature<GeoJsonPoint>' / GeoJsonFeatureType.point
Closing
Application finished.
Flutter 1.23.0-18.1.pre • channel beta • https://github.com/flutter/flutter.git
Framework • revision 198df796aa (4 weeks ago) • 2020-10-15 12:04:33 -0700
Engine • revision 1d12d82d9c
Tools • Dart 2.11.0 (build 2.11.0-213.1.beta)

But there is no geojson on the map. Please help out if you can spare some time.

1: https://github.com/synw/map_controller/blob/71a0a6001d7adce16457b4b944ce5952d0292ba6/lib/src/controller.dart#L234

See also: https://github.com/synw/iso/issues/3

4F2E4A2E commented 4 years ago

image

geojson/multiPolygon

{
  "type": "FeatureCollection",
  "features": [
    {
      "type": "Feature",
      "properties": {
        "stroke": "#555555",
        "stroke-width": 2,
        "stroke-opacity": 1,
        "fill": "#eb0a0a",
        "fill-opacity": 0.5
      },
      "geometry": {
        "type": "MultiPolygon",
        "coordinates": [
          [
            [
              [
                -71.015625,
                53.4357192066942
              ],
              [
                -105.64453124999999,
                1.9332268264771233
              ],
              [
                -28.828124999999996,
                -15.623036831528252
              ],
              [
                -1.0546875,
                46.195042108660154
              ],
              [
                -71.015625,
                53.4357192066942
              ]
            ]
          ]
        ]
      }
    }
  ]
}

geojson/polyline

{
  "type": "FeatureCollection",
  "features": [
    {
      "type": "Feature",
      "properties": {
        "stroke": "#555555",
        "stroke-width": 2,
        "stroke-opacity": 1,
        "fill": "#fa0505",
        "fill-opacity": 0.5
      },
      "geometry": {
        "type": "Polygon",
        "coordinates": [
          [
            [
              -113.5546875,
              46.800059446787316
            ],
            [
              -65.390625,
              -13.410994034321702
            ],
            [
              3.1640625,
              18.979025953255267
            ],
            [
              11.6015625,
              53.4357192066942
            ],
            [
              -113.5546875,
              46.800059446787316
            ]
          ]
        ]
      }
    }
  ]
}

geojson tested with http://geojson.io image

berkayoruc commented 3 years ago

I have same problem and I found that all geojson features need unique "name" properties. Just try that. At least for points @X-SLAYER

PavKovalenko commented 3 years ago

Had similar problem. GeoJson draw only last point. Adding unique "name" property helped @berkayoruc Thank you.