public VectorGeometry filterPointsOutsideBuffer(double buffer) {
      if (geomType != GeometryType.POINT) {
        return this;
      }
      IntArrayList result = null;

      int extent = (EXTENT << scale);
      int bufferInt = (int) Math.ceil(buffer * extent / 256);
      int min = -bufferInt;
      int max = extent + bufferInt;

      int x = 0;
      int y = 0;
      int lastX = 0;
      int lastY = 0;

      int geometryCount = commands.length;
      int length = 0;
      int i = 0;

      while (i < geometryCount) {
        if (length <= 0) {
          length = commands[i++] >> 3;
          assert i <= 1 : "Bad index " + i;
        }

        if (length > 0) {
          length--;
          x += zigZagDecode(commands[i++]);
          y += zigZagDecode(commands[i++]);
          if (x < min || y < min || x > max || y > max) {
            if (result == null) {
              // short-circuit the common case of only a single point that gets filtered-out
              if (commands.length == 3) {
                return EMPTY_POINT;
              }
              result = new IntArrayList(commands.length);
              result.add(commands, 0, i - 2);
            }
          } else {
            if (result != null) {
              result.add(zigZagEncode(x - lastX), zigZagEncode(y - lastY));
            }
            lastX = x;
            lastY = y;
          }
        }
      }
      if (result != null) {
        if (result.size() < 3) {
          result.elementsCount = 0;
        } else {
          result.set(0, Command.MOVE_TO.value | (((result.size() - 1) / 2) << 3));
        }

        return new VectorGeometry(result.toArray(), geomType, scale);
      } else {
        return this;
      }
    }
If this is a point, returns an empty geometry if more than {@code buffer} pixels outside the tile bounds, or if
it is a multipoint than removes all points outside the buffer.
planetiler-core/src/main/java/com/onthegomap/planetiler/VectorTile.java