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

GaiaGeoReader.Read(byte[] blob) throws an exception in case the envelope Coordinates read from the blob contain double.NaN #9

Open
UliEgger opened this issue Mar 17, 2023 · 5 comments

Comments

@UliEgger
Copy link

UliEgger commented Mar 17, 2023

Dear developers,

It seems to be normal, that a Coordinate can contain an Ordinate double.NaN as defined in
NetTopologySuite.Geometries.Coordinate.NullOrdinate

public const double NullOrdinate = NaN

https://nettopologysuite.github.io/NetTopologySuite/api/NetTopologySuite.Geometries.Coordinate.html

A point that contains such a Coordinate can be stored to a database as a blob unsing GaiaGeoWriter.Write(Geometry geom)

However when using GaiaGeoReader.Read to get back the Geometry from the blob value (when reading from database),
an exception is thrown at this location:

Evenlope.Init

grafik

Further down in the call stack, we see that an Envelope is created but not used in GaiaGeoReader.Read:

grafik

Would it be possible that this is removed and a new version of the nuget-Package can be provided ?

Thank you very much, best regards,
Ulrich Egger

@UliEgger
Copy link
Author

UliEgger commented Mar 17, 2023

I guess gaiaImport.GetDouble has still to be called four times at that place, but without creating the evelope.

@UliEgger
Copy link
Author

UliEgger commented Mar 17, 2023

If I use the current version of GaiaGeoWriter to write the geometry, the problem does not occur. It occurs in case of the blob has been wirtten by an earlier version.

It looks like current version created a null envelope for a Point with X = 550123 and Y = double.NaN

grafik

and this envelope is valid.

@UliEgger
Copy link
Author

Currently used version is 2.0.0
Previously used version, where the bug did not occur when reading but wirtes blobs that cannot be read with the current version was 1.14.4

@UliEgger
Copy link
Author

UliEgger commented Mar 17, 2023

In the earlier used version of NetTopologySuite the constructor of envelope / Init method did not throw an exception when using double.NaN.

@UliEgger UliEgger changed the title GaiaGeoReader.Read(byte[] blob) throws an exception in case Coordinates contain double.NaN GaiaGeoReader.Read(byte[] blob) throws an exception in case the envelope Coordinates read from the blob contain double.NaN Mar 17, 2023
@UliEgger
Copy link
Author

I have created a pull request

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