2

I have this two geometries:

StreamGeometry geo1 = Geometry.Parse("M590202.895,5958727.621L590280.305,5958747.961L590337.012,5958762.785L590337.172,5958763.234L590337.412,5958763.914L590280.065,5958748.931L590241.24,5958738.726L590202.576,5958728.98z");

which looks like this

geo1

and

StreamGeometry geo2 = Geometry.Parse("M590241.24,5958738.726L590280.195,5958748.551L590337.172,5958763.234L590337.412,5958763.914L590280.065,5958748.931L590241.24,5958738.726z");

which looks like this: geo2

When I look at these objects in a GIS system geo2 is fully contained in geo1 in the upper right corner:

Both geometries together

When I get the intersection of both by

PathGeometry intersection = PathGeometry.Combine(geo1, geo2, GeometryCombineMode.Intersect, null);

I get

{F1M590241,25;5958738,5L590280,1875;5958748,5 590332,3125;5958762 590337;5958763 590337,1875;5958763 590337,4375;5958764 590280,0625;5958749 590241,25;5958738,5z}

which looks quite strange:

enter image description here

In detail there are irritating discrepancies. For example at the right end the red marked intersection geometrie isn't at all, what I was expecting.

upper right corner with discrepancies

I tried Combinewith different tolerance values, but with no effect to the result.

What's going wrong here?

* Update * I closed the geometries as @Sinatr supposed and simplified the first one by leaving out the left part of it. Both doesn't affect the outcome.

gumo
  • 645
  • 15
  • 35
  • 1
    I think it's [non-closing intersection geometry problem](http://stackoverflow.com/q/25563953/1997232). Because of it I switch to GDI+ in wpf. Can you produce enclosed geometry? Remove last point and put there `Z` instead. – Sinatr Mar 09 '15 at 15:35
  • So you think the problem might be caused because the first point is added as last point instead of telling PathGeometry to close the geometry? Great idea, can't wait to see if this will change the problem! – Sam Mar 09 '15 at 16:06
  • @Sinatr Thanks for the suggestion. Closing the geometries did not change the result. I updated the question though. – gumo Mar 10 '15 at 10:10

1 Answers1

0

We were in contact with Microsoft regarding this issue. The problem here is, that the WPF Geometry objects are designed for visualisation purposes. So the can't handle very large coordinates like we did here. The recommended way is to use SqlGeometry. We have good results there.

gumo
  • 645
  • 15
  • 35