Skip to content

Instantly share code, notes, and snippets.

@jegade
Last active September 22, 2015 13:10
Show Gist options
  • Save jegade/f7c2a2aa92eabbaa6331 to your computer and use it in GitHub Desktop.
Save jegade/f7c2a2aa92eabbaa6331 to your computer and use it in GitHub Desktop.
Check if coordinate in poly-file perl
#!/bin/env perl
use Math::Polygon::Tree;
# nrw.poly - shapefile of nrw from http://download.geofabrik.de/europe/germany/nordrhein-westfalen.poly
my $bound = Math::Polygon::Tree->new( 'nrw.poly' );
if ( $bound->contains( [6.744400, 50.797427] ) ) {
say "In nrw";
}
unless ( $bound->contains( [ 8.378689, 50.434742] ) ) {
say "not in nrw";
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment