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

Feature creation error #18

Open
MarcoGiorgi opened this issue Sep 14, 2019 · 1 comment
Open

Feature creation error #18

MarcoGiorgi opened this issue Sep 14, 2019 · 1 comment

Comments

@MarcoGiorgi
Copy link

When I try to create GeoJSON file from a SQL Server table with the geographies of the world countries, I get the following error on both the Russian Federation and Antarctica:

Exception has been thrown by the target of an invocation. at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor) at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments) at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) at System.Data.Entity.SqlServer.SqlSpatialServices.GetSpatialTypeName(DbGeometry geometryValue) at alatas.GeoJSON4EntityFramework.GeoJsonGeometry._Closure$__13-0._Lambda$__0(Type t) in C:\a\1\s\GeoJSON4EntityFramework\Base\GeoJsonGeometry.vb:line 31 at System.Linq.Enumerable.WhereSelectArrayIterator2.MoveNext()
at System.Linq.Enumerable.FirstOrDefault[TSource](IEnumerable1 source) at alatas.GeoJSON4EntityFramework.GeoJsonGeometry.FromDbGeometry(DbGeometry inp, Boolean withBoundingBox) in C:\a\1\s\GeoJSON4EntityFramework\Base\GeoJsonGeometry.vb:line 30 at alatas.GeoJSON4EntityFramework.Feature.FromDbGeography(DbGeography inp, Boolean withBoundingBox) in C:\a\1\s\GeoJSON4EntityFramework\Elements\Feature.vb:line 50

They are not the biggest geographies I have in the DB because USA, Canada, and Australia, for example, are much bigger in terms of the number of polygons and points.

I've tried to reduce their size, but I still get the error.
The geographies are valid and made only by Polygons (they are MULTIPOLYGON type)

I've tried also to convert the Geography field to a Geometry, but I get always the same error:
Exception has been thrown by the target of an invocation. at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor) at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments) at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) at System.Data.Entity.SqlServer.SqlSpatialServices.GetSpatialTypeName(DbGeometry geometryValue) at alatas.GeoJSON4EntityFramework.GeoJsonGeometry._Closure$__13-0._Lambda$__0(Type t) in C:\a\1\s\GeoJSON4EntityFramework\Base\GeoJsonGeometry.vb:line 31 at System.Linq.Enumerable.WhereSelectArrayIterator2.MoveNext()
at System.Linq.Enumerable.FirstOrDefault[TSource](IEnumerable1 source) at alatas.GeoJSON4EntityFramework.GeoJsonGeometry.FromDbGeometry(DbGeometry inp, Boolean withBoundingBox) in C:\a\1\s\GeoJSON4EntityFramework\Base\GeoJsonGeometry.vb:line 30 at alatas.GeoJSON4EntityFramework.Feature.FromDbGeometry(DbGeometry inp, Boolean withBoundingBox) in C:\a\1\s\GeoJSON4EntityFramework\Elements\Feature.vb:line 46

What could be the cause?

@MarcoGiorgi
Copy link
Author

I think I've found the reason of the bug: the library it's not able to parse geography data that is crossing the +-180 meridian.

Here a simple WKT to reproduce the issue:

POLYGON ((-169.00451639800042 65.793419084000234, 19.638524229999991 54.458776600000007, 36.63701655600007 45.1347316689999, 37.457572158000261 44.705561845000105, 39.947924062000212 43.398832927000065, 39.992308860000122 43.383941952000072, 47.558991999999719 41.197630999999816, 47.781746000000354 41.185353000000219, 47.883701999999943 41.218517000000112, 87.427347000000324 49.071318000000318, 130.70312394600015 42.29456626599984, 133.15585223599993 42.686580685000429, 133.73162678999992 42.808101914000275, 149.54391402799985 45.56836747800012, 149.62840426799977 45.593189045000329, 149.68458593999992 45.619068171000272, 151.8380278920003 46.773881637999956, 168.13212723900006 54.490304475000457, -172.23352026500024 64.403679854999822, -169.06665053099957 65.747734436999863, -169.00451639800042 65.793419084000234))

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

No branches or pull requests

1 participant