oracle_fdw
oracle_fdw copied to clipboard
Oriented point geometries
Great work, thanks!
I noticed that the oracle fdw does not load oracle oriented point types where etype==1 and interpretation==0
on the 2nd triplet of the ELEM_INFO
array of the oracle geometry.
For example I have a geometry like this:
MDSYS.SDO_GEOMETRY(3001, NULL, NULL, MDSYS.SDO_ELEM_INFO_ARRAY(1, 1, 1, 4, 1, 0), MDSYS.SDO_ORDINATE_ARRAY(766341.565377519, 172101.790047221, 0, 1, 0, 0))
I checked in oracle_gis.c
that the ewkbPointFill
method does not care about any triplet after the 1st so it would happily convert it to normal point that would perfectly fit the purpose if one can afford to loose the orientation (I can). I know that postgis does not have this oriented point type.
I'm not sure about multipoints though. I think ewkbMultiPointFill needs to skip every 2nd triplet of ELEM_INFO as they are not coordinates.
I wonder if you thought about this.
I hope that @vmora, who wrote the code, can give an answer offhand, else I'll have to try to dig into it.
What we did with @brncsk is that we modified the condition in oracle_gis.c
to handle this case for simple POINTS.
https://github.com/csandor/oracle_fdw/commit/d05572243c34aec17f69c22d5a7d91861e9757b0
This will most probably not work for MULTIPOINTS though.
@vmora, @vpicavet, could anyone comment on that?
I finally got around to looking at this, sorry for the delay.
The idea is to accept oriented points from Oracle, throw away their orientation and convert them to normal points, right?
That seems reasonable.
I agree that your one-liner wouldn't work for multipoints — ewkbMultiPointLen
would count the “orientation vector end point” as regular coordinates, and ewkbMultiPointFill
would happily convert them.
But that doesn't seem to be a problem, as multipoints have a different SDO_GTYPE
than points.
So, unless I'm missing something here, your little patch will make oracle_fdw accept oriented points, but still reject oriented multipoints.
In other words, it shouldn't break anything, right?
If I got that right, and you tested the patch to make sure it is working as expected (rejects oriented multipoints, converts oriented points), I have no objection to pulling that patch into oracle_fdw.
Any feedback on this? Do you think your one-liner is ready for pulling?
I did not have a chance to test it on oriented multipoints so far, sorry. I don't have a writable oracle environement at hand.
I looked at oracle editions and it says that only EE edition has spatial :( I need to find a running instance and ask some favor to test this.
Oh — this is not supported by Oracle Locator (which is free of charge)?
I don't have Oracle Enterprise Edition either.
I am willing to blindly push the code if you can test it. If cannot do that either (which I would understand), tell me, and we close the issue.
Thanks for your efforts!
I now have an writable EE instance to play with I have to find some time to do that this week.
I guess I'll have to close this as abandoned.