0

I have the following FeatureCollection:

{
  "type": "FeatureCollection",
  "features": [
    {
      "id": 47306,
      "type": "Feature",
      "properties": {},
      "geometry": {
        "type": "Polygon",
        "coordinates": [
          [
            [-122.39671085934447, 37.78583881850997],
            [-122.39703782289067, 37.78558201523226],
            [-122.39672620759627, 37.785316575130906],
            [-122.39549821835855, 37.78543823104164],
            [-122.38991847492396, 37.7861749633756],
            [-122.38971972536494, 37.786010524276314],
            [-122.38965739397551, 37.78601669588756],
            [-122.38937324901592, 37.78622798143154],
            [-122.38918828084734, 37.78674889493234],
            [-122.3885013378262, 37.789318227737695],
            [-122.38820072233521, 37.789529957984165],
            [-122.38817825741788, 37.789593218839855],
            [-122.38846549043052, 37.78986695242534],
            [-122.38848602616041, 37.78988572155204],
            [-122.38848903705924, 37.789884744008475],
            [-122.3885755860934, 37.789812605239256],
            [-122.38858832214783, 37.78982615174176],
            [-122.38859205735288, 37.78982948076506],
            [-122.38980485271871, 37.79073841641708],
            [-122.38962637202224, 37.790883013838766],
            [-122.38962001002272, 37.790890374237236],
            [-122.38961618775028, 37.79089703406531],
            [-122.38961951836387, 37.79092168394102],
            [-122.38989938353893, 37.791177462382194],
            [-122.39039965582542, 37.79079522367611],
            [-122.39042871149674, 37.790772407575915],
            [-122.39042851056843, 37.790771178393626],
            [-122.39041979701763, 37.79075669125585],
            [-122.39013965368244, 37.79052356312754],
            [-122.39012902223803, 37.79051768490699],
            [-122.39011785702665, 37.79051385578674],
            [-122.39009246251392, 37.79051372081039],
            [-122.39008123367302, 37.79051743090234],
            [-122.39007050396465, 37.7905231955846],
            [-122.38996291196904, 37.790610362872705],
            [-122.3897461413152, 37.78659728857078],
            [-122.38974590103008, 37.78659507451624],
            [-122.38973060575131, 37.78650149503642],
            [-122.38977712837992, 37.78650219340372],
            [-122.38978242815048, 37.78650192871734],
            [-122.39634780059684, 37.78574297429531],
            [-122.39573436180176, 37.786194168589006],
            [-122.39573154081675, 37.78619207462933],
            [-122.39571200201476, 37.78617757137022],
            [-122.39570162006085, 37.78617238115461],
            [-122.39568927671853, 37.78616855582978],
            [-122.3956651781472, 37.78616869742164],
            [-122.39565290752299, 37.78617266736638],
            [-122.39564262353554, 37.78617797900521],
            [-122.39561850286574, 37.78619642217776],
            [-122.39559937223466, 37.78621104985136],
            [-122.39538037238738, 37.78637850099537],
            [-122.39537284848093, 37.78638729376914],
            [-122.39536738108231, 37.78639787655596],
            [-122.3953680572083, 37.786418671113076],
            [-122.3953742050654, 37.78642901602967],
            [-122.39538229037211, 37.78643748913957],
            [-122.3955939012627, 37.78658335851744],
            [-122.39561460774016, 37.786589675990655],
            [-122.39564247329386, 37.78659009290003],
            [-122.3956643911925, 37.78658378518263],
            [-122.39583225326858, 37.78646820792209],
            [-122.39583415962431, 37.786466784651225],
            [-122.39592599794132, 37.786392465986594],
            [-122.39593301380579, 37.78638389940416],
            [-122.39593812300889, 37.786373659618796],
            [-122.39593757841602, 37.78635363464769],
            [-122.39593325053531, 37.786345947477905],
            [-122.39659335573167, 37.78575034285853],
            [-122.39670406737187, 37.785836519652804],
            [-122.39671085934447, 37.78583881850997]
          ]
        ]
      }
    },
    {
      "id": 4706,
      "type": "Feature",
      "geometry": {
        "type": "MultiPolygon",
        "coordinates": [
          [
            [
              [-122.388634342863, 37.7892720035641],
              [-122.38884862241, 37.7895476290123],
              [-122.388465513347, 37.7898669525957],
              [-122.388178280367, 37.7895932190108],
              [-122.388634342863, 37.7892720035641]
            ]
          ]
        ]
      },
      "properties": {
        "semanticFeatureOrigin": "sections_overview",
        "semanticFeatureType": "MiniIntersection",
        "name": "SF2_1",
        "labelStatus": 1,
        "encounterStalenessThresholdDays": 7,
        "reviewMinimumThresholdDays": 5,
        "manualVerificationReviewTier": 1
      }
    }
  ]
}

As you can see by pasting it to geojson.io for example, one - smaller geometry is fully contained in another - bigger one.

enter image description here

However @turf/boolean-contains still returns false for it. Why? Or how can I implement equivalent check of whether area of smaller one fully falls under the area of bigger one - they can touch on the edges, but still.

  • that looks like they share edge points so it is not contained, see gis.stackexchange.com/questions/368520/… for some discussion – Ian Turton Oct 8 at 8:46
  • Clementini operators are likely to implement Clementini topology rules. Letting vertex precision expand into nanometer range isn't helping in the comparison of "within". – Vince Oct 8 at 11:56
  • Turf booleanConatins method requires no common boundary points: "The interiors of both geometries must intersect and, the interior and boundary of the secondary (geometry b) must not intersect the exterior of the primary (geometry a).` If you allow for common boundaries, you must use booleanWithin method. – TomazicM Oct 9 at 17:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.