-
Notifications
You must be signed in to change notification settings - Fork 8
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
New ordinate handling behavior #8
Comments
Yeah... I started thinking along the same lines right around the time that I wrote my comment in #5. The hesitation I have is that, on the writer side, this differs from how both That hesitation isn't a dealbreaker for me, since IMO, NetTopologySuite.IO.PostGis should strongly lean towards what npgsql needs/wants from it. @FObermaier thoughts? |
@airbreather maybe it's worth having the conversation with the EF Core folks... The current behavior is problematic for anyone dealing with mixed ordinates in the same application, and I don't think there's anything PostgreSQL-specific in this. I also agree that it's desirable to have writers/readers behave in the same way (although that shouldn't block us from better behavior either). @bricelam any thoughts/comments? |
I believe the proposal is similar to what SqlServerBytes does. A geometry is an XYZ geometry if and only if it specifies a Z value (0 is a value; NaN/NULL is not). SQLite is a trickier because you can't store an XY geometry in an XYZ column. The serialized value must include Z even if it's NaN. |
@roji is Postgis lenient to allow XY geometries in XYZ/M columns? My use case for having the reader return exactly the ordinates specified in I see that OR ing |
PostGIS allows columns to be defined in two ways:
I'm not sure there is, but the point about PostGisWriter (and Reader) is that it should be possible to share them across multiple columns, and it seems much more acceptable to mix XY and XYZ within the same database. At least at the moment, Npgsql instantiates one writer and reader for a physical connection at the database (it may even use single instances for all connections in the future); it would be problematic (and odd) to have to instantiate a writer for different columns because their ordinates are different.
Understood, but if one wants to convert an XY point stored in the database to an XYZ point for any reason, that's very easy to do by the user and doesn't seem like it should be the responsibility of the reader - it seems to me that the latter should simply read the geometry object as it is defined in the database. Note that there are two separate questions here:
|
Yeah, I understand what you mean. Though it's worth mentioning that assuming |
This would be useful (although not essential) for us when converting to/from geometries in NHibernate.Spatial.PostGis. |
ping |
Sorry for the delay. Having thought about it over for a while, I'd propose the follwing:
|
Thanks for the response @fobermeier, I'll submit a PR on this soon. I can also look at the other IO projects after this one. |
* HandleOrdinates on both reader and writer now act only as an "upper bound" - coordinates not specified in HandleOrdinates will be stripped when reading and writing objects. * The meaning of Ordinates.None has been changed to mean that objects are read and written as-is, without either stripping or adding any coordinates. * Ordinates.None is now the default. Fixes NetTopologySuite#8
* HandleOrdinates on both reader and writer now act only as an "upper bound" - coordinates not specified in HandleOrdinates will be stripped when reading and writing objects. * The meaning of Ordinates.None has been changed to mean that objects are read and written as-is, without either stripping or adding any coordinates. * Ordinates.None is now the default. Fixes NetTopologySuite#8
In #5 I addressed a problem with ordinates handling, but the issue seems wider, so I'm opening a discussion here.
Both PostGisWriter and PostGisReader have a HandleOrdinates property on them. These properties determine the ordinates sent and received,
In effect, there seems to be no way to simply send or receive a point, with all its ordinates (and nothing but its ordinates): the user must currently set the ordinates manually on the writer and reader beforehand. Aside from being odd and unnecessary, this makes it awkward to work in situations where geometry objects of varying ordinates are used: writing both 2D and 3D points involves having two writers and two readers (or constantly changing the ordinates properties on them).
Here's a proposal for a new behavior:
Ordinates.None
would mean that the reader/writer have no particular setting, and would always simply pass through the object as-is, without adding or removing anything.Ordinates.None
would become the default behavior for PostGisWriter and PostGisReader.Note that the
Ordinates.None
behavior is already somewhat present in PostGisWriter, but is disabled as described in #6.If this is accepted, I'll submit a PR for the changes including tests.
/cc @austindrenski @YohDeadfall
The text was updated successfully, but these errors were encountered: