turf_dart icon indicating copy to clipboard operation
turf_dart copied to clipboard

Override hashCode and overload == operator for GeoJSON types

Open lukas-h opened this issue 4 years ago • 3 comments

  • [x] Position
  • [x] BBox
  • [x] Point
  • [ ] MultiPoint
  • [ ] LineString
  • [ ] MultiLineString
  • [ ] Polygon
  • [ ] MultiPolygon
  • [ ] GeometryCollection
  • [x] Feature
  • [ ] FeatureCollection

as discussed in #43

lukas-h avatar Dec 12 '21 04:12 lukas-h

:+1: on this issue, to be able to scale the functionality of this library, this is a must have feature.

For context, was adding a new functionality and couldn't easily compare two FeatureCollections:

GeoJSONObject actual = flip(GeoJSONObject.fromJson(json));
GeoJSONObject expected = GeoJSONObject.fromJson(flippedJson);
expect(actual, expected);

tobrun avatar Mar 19 '22 10:03 tobrun

Hi @tobrun,

we are currently working on a separate library that offers equality functions for the more complex data types of geojson. https://github.com/dartclub/turf_equality The lib is based on: https://www.npmjs.com/package/geojson-equality

We have to find a way to combine the new lib into turf_dart at a later point.

And I still think it's a problem if we override == with a really performance hungry function that can compare e.g. highly nested FeatureCollections.

CC @armantorkzaban

lukas-h avatar Jun 27 '22 09:06 lukas-h

–> DECISION: What should be done with booleanEqual?

lukas-h avatar Sep 11 '22 15:09 lukas-h