Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Polygon / rectangle intersection returns empty polygon #149

Closed
manuschiller opened this issue Feb 2, 2017 · 1 comment
Closed

Polygon / rectangle intersection returns empty polygon #149

manuschiller opened this issue Feb 2, 2017 · 1 comment
Assignees
Labels

Comments

@manuschiller
Copy link

I am trying to get the intersection between a rectangle and a polygon.

illustration

However, the result is always { POLYGON EMPTY }
What am I doing wrong?

var wktreader = new WKTReader();
var polygon = wktreader.Read(@"POLYGON ((-62.327500000000008 77.777166176470587,
 -62.327500000000008 191.08,
 -39.425176714633878 191.08,
 30.449401394787785 111.06902734290135,
 34.240621449176217 85.17199763498823,
 32.474968591813237 66.628747810197453,
 29.724407935551895 56.755281980420541,
 10.963366463822565 52.502595315049426,
 -62.327500000000008 77.777166176470587))");

var boundingbox = wktreader.Read(@"POLYGON ((-52.5 -34, -52.5 34, 52.5 34, 52.5 -34, -52.5 -34))");
var result = boundingbox.Intersection(polygon); // =>{ POLYGON EMPTY }
var resultInverted = polygon.Intersection(boundingbox); // => { POLYGON EMPTY }
@FObermaier
Copy link
Member

The given polygon and bounding box don't intersect:
tmp99d5

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants