@Test
  void testLabelGridLimit() throws Exception {
    double y = 0.5 + Z14_WIDTH / 2;
    double lat = GeoUtils.getWorldLat(y);

    double x1 = 0.5 + Z14_WIDTH / 4;
    double lng1 = GeoUtils.getWorldLon(x1);
    double lng2 = GeoUtils.getWorldLon(x1 + Z14_WIDTH * 10d / 256);
    double lng3 = GeoUtils.getWorldLon(x1 + Z14_WIDTH * 20d / 256);

    var results = runWithReaderFeatures(
      Map.of("threads", "1"),
      List.of(
        newReaderFeature(newPoint(lng1, lat), Map.of("rank", "1")),
        newReaderFeature(newPoint(lng2, lat), Map.of("rank", "2")),
        newReaderFeature(newPoint(lng3, lat), Map.of("rank", "3"))
      ),
      (in, features) -> features.point("layer")
        .setZoomRange(13, 14)
        .inheritAttrFromSource("rank")
        .setSortKey(Integer.parseInt(in.getTag("rank").toString()))
        .setPointLabelGridSizeAndLimit(13, 128, 2)
        .setBufferPixels(128)
    );

    assertSubmap(Map.of(
      TileCoord.ofXYZ(Z14_TILES / 2, Z14_TILES / 2, 14), List.of(
        feature(newPoint(64, 128), Map.of("rank", "1")),
        feature(newPoint(74, 128), Map.of("rank", "2")),
        feature(newPoint(84, 128), Map.of("rank", "3"))
      ),
      TileCoord.ofXYZ(Z13_TILES / 2, Z13_TILES / 2, 13), List.of(
        // omit rank=3 due to label grid size
        feature(newPoint(32, 64), Map.of("rank", "1")),
        feature(newPoint(37, 64), Map.of("rank", "2"))
      )
    ), results.tiles);
  }
In-memory tests with fake data and profiles to ensure all features work end-to-end.
planetiler-core/src/test/java/com/onthegomap/planetiler/PlanetilerTests.java