ifsnop/martinez-rueda-php

Robust and tested library for boolean operations on polygons (union, intersection, difference, xor)

Maintainers

Package info

github.com/ifsnop/martinez-rueda-php

pkg:composer/ifsnop/martinez-rueda-php

Statistics

Installs: 1

Dependents: 0

Suggesters: 0

Stars: 3

Open Issues: 0

1.0.1 2026-05-10 09:48 UTC

This package is auto-updated.

Last update: 2026-05-10 09:51:53 UTC


README

Robust and tested library for boolean operations on polygons (union, intersection, difference, xor) in PHP.

Some improvements over other libraries: This one is tested (see end-to-end directory) and optimized to use polygons with large amount of vertex (ie, binary search when doing intersections between segments).

This library can use arrays with polygons, geojson strings or geojson files directly.

Resources

Examples

Some tests and demo implementation inside tests.php, extended coverage with PHPUnit:

  • php tests.php
  • ./vendor/bin/phpunit tests/
  • ./vendor/phpstan/phpstan/phpstan --error-format=raw

For profiling:

  • check that xdebug module is available and loaded: php -m | grep xdebug
  • launch php with xdebug enabled: php
    -dxdebug.mode=profile
    -dxdebug.start_with_request=yes
    -dxdebug.output_dir=xdebug-profiler/
    tests.php

Tutorials and notes

Improvements

History