Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for GeometryCollection #19

Open
FarhanSajid1 opened this issue Apr 27, 2022 · 0 comments
Open

Support for GeometryCollection #19

FarhanSajid1 opened this issue Apr 27, 2022 · 0 comments

Comments

@FarhanSajid1
Copy link

I was attempting to display a geometry collection using mapbox and ran up the stack until I saw the geometry model in this package, it appears it does not have the geometries field necessary for handling GeometryCollections.

Current logic

  factory Geometry({
    String? type,
    dynamic coordinates,
  }) =>
      Geometry.fromJsObject(GeometryJsImpl(
        type: type,
        coordinates: coordinates,
      ));

  /// Creates a new Geometry from a [jsObject].
  Geometry.fromJsObject(GeometryJsImpl jsObject) : super.fromJsObject(jsObject);

I believe this needs to be updated to something like

  factory Geometry({
    String? type,
    dynamic coordinates,
    dynamic geometries
  }) =>
      Geometry.fromJsObject(GeometryJsImpl(
        type: type,
        coordinates: coordinates,
       geometries: geometries,
      ));

I've created the corresponding issue in the mapbox-gl-web repo:
flutter-mapbox-gl/maps#1017

An example of the type of data this will server would be:

{
    "geometry": {
        "geometries": [
            {
                "coordinates": [
                    -73.9378039,
                    40.6067712
                ],
                "type": "Point"
            },
            {
                "coordinates": [
                    -73.9377864,
                    40.6069361
                ],
                "type": "Point"
            },
            {
                "coordinates": [
                    -73.9377368,
                    40.6071001
                ],
                "type": "Point"
            },
            {
                "coordinates": [
                    -73.937714,
                    40.6062835
                ],
                "type": "Point"
            },
            {
                "coordinates": [
                    -73.9376657,
                    40.6072579
                ],
                "type": "Point"
            },
            {
                "coordinates": [
                    -73.9376429,
                    40.6061267
                ],
                "type": "Point"
            },
            {
                "coordinates": [
                    [
                        [
                            -73.9276617,
                            40.5970339
                        ],
                        [
                            -73.9275492,
                            40.5969335
                        ],
                        [
                            -73.9277521,
                            40.5968025
                        ],
                        [
                            -73.9278645,
                            40.5969029
                        ],
                        [
                            -73.9276617,
                            40.5970339
                        ]
                    ]
                ],
                "type": "Polygon"
            },
            {
                "coordinates": [
                    [
                        [
                            -73.9276726,
                            40.5970446
                        ],
                        [
                            -73.9278759,
                            40.5969146
                        ],
                        [
                            -73.9279879,
                            40.5970156
                        ],
                        [
                            -73.9277846,
                            40.5971456
                        ],
                        [
                            -73.9276726,
                            40.5970446
                        ]
                    ]
                ],
                "type": "Polygon"
            },
            {
                "coordinates": [
                    [
                        [
                            -73.927182,
                            40.6058754
                        ],
                        [
                            -73.9273275,
                            40.6061209
                        ],
                        [
                            -73.9270803,
                            40.6062806
                        ],
                        [
                            -73.9268595,
                            40.606083
                        ],
                        [
                            -73.927182,
                            40.6058754
                        ]
                    ]
                ],
                "type": "Polygon"
            },
            {
                "coordinates": [
                    [
                        [
                            -73.9277674,
                            40.59679
                        ],
                        [
                            -73.9279722,
                            40.5966571
                        ],
                        [
                            -73.9280864,
                            40.5967585
                        ],
                        [
                            -73.9278815,
                            40.5968914
                        ],
                        [
                            -73.9277674,
                            40.59679
                        ]
                    ]
                ],
                "type": "Polygon"
            },
            {
                "coordinates": [
                    [
                        [
                            -73.9280046,
                            40.5970042
                        ],
                        [
                            -73.9278942,
                            40.5969041
                        ],
                        [
                            -73.9281026,
                            40.5967715
                        ],
                        [
                            -73.9282131,
                            40.5968715
                        ],
                        [
                            -73.9280046,
                            40.5970042
                        ]
                    ]
                ],
                "type": "Polygon"
            },
            {
                "coordinates": [
                    [
                        [
                            -73.9380157,
                            40.606164
                        ],
                        [
                            -73.9379062,
                            40.6060636
                        ],
                        [
                            -73.9381631,
                            40.605902
                        ],
                        [
                            -73.9382726,
                            40.6060023
                        ],
                        [
                            -73.9380157,
                            40.606164
                        ]
                    ]
                ],
                "type": "Polygon"
            },
            {
                "coordinates": [
                    [
                        [
                            -73.936987,
                            40.608681
                        ],
                        [
                            -73.9366055,
                            40.6089156
                        ],
                        [
                            -73.9362013,
                            40.6085366
                        ],
                        [
                            -73.9365828,
                            40.6083021
                        ],
                        [
                            -73.9367915,
                            40.6084978
                        ],
                        [
                            -73.936987,
                            40.608681
                        ]
                    ]
                ],
                "type": "Polygon"
            }
        ],
        "type": "GeometryCollection"
    },
    "type": "Feature",
    "properties": {}
    }
}

Is this something that is on the roadmap, are there any limitations of adding this? I can image that if the coordinates are null, things might break

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant