oracle_fdw icon indicating copy to clipboard operation
oracle_fdw copied to clipboard

Oriented point geometries

Open csandor opened this issue 6 years ago • 9 comments

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.

csandor avatar Mar 26 '18 10:03 csandor

I hope that @vmora, who wrote the code, can give an answer offhand, else I'll have to try to dig into it.

laurenz avatar Mar 26 '18 19:03 laurenz

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.

csandor avatar Mar 27 '18 07:03 csandor

@vmora, @vpicavet, could anyone comment on that?

laurenz avatar Apr 09 '18 19:04 laurenz

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.

laurenz avatar May 12 '18 03:05 laurenz

Any feedback on this? Do you think your one-liner is ready for pulling?

laurenz avatar Jun 07 '18 19:06 laurenz

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.

csandor avatar Jun 08 '18 14:06 csandor

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.

csandor avatar Jun 08 '18 15:06 csandor

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!

laurenz avatar Jun 11 '18 06:06 laurenz

I now have an writable EE instance to play with I have to find some time to do that this week.

csandor avatar Jun 11 '18 07:06 csandor

I guess I'll have to close this as abandoned.

laurenz avatar Nov 24 '22 08:11 laurenz