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

Can I propose some missing casts ? #5

Open
Remi-C opened this issue Nov 7, 2016 · 2 comments
Open

Can I propose some missing casts ? #5

Remi-C opened this issue Nov 7, 2016 · 2 comments

Comments

@Remi-C
Copy link

Remi-C commented Nov 7, 2016

Hey again @koenedaele,

I settled on this version of simple fuzzy intervals.
For the moment it works very well (except installation which is a little bit broken, no big deal)

However I ended up needing few functions more,
such as basic casts (sfti to record, to array, to float, to numrange ),
as well a a cast to geometry (an easy way to use indexing).

Here is the list of the new functions

Would you be open to a PR ?
Cheers,
Rémi-C

@koenedaele
Copy link
Member

Hi @Remi-C .Thanks for your interest. Yes, we're certainly open to a PR or some other form of collaboration. Only issue I'm not sure about at the moment is introducing a dependency on PostGIS for this extension (although all our databases runs Postgis already, so it might make sense). Currently thinking if the PostGIS functions should be a separate extension. Or I might be able to rewrite some functions to get rid of the PosGIS functions.

I believe a lot of your functions are about reconverting from SFTI to something else. While we mostly had functions to go from something to SFTI?

@koenedaele
Copy link
Member

@Remi-C I've implemented casts from sfti to int and float in the sfti extension itself.

pgsfti=# SELECT fti::float, fti::int, fti::smallint, fti FROM test_sfti LIMIT 5;
  fti   | fti  | fti  |                            fti                             
--------+------+------+------------------------------------------------------------
 2562.5 | 2563 | 2563 | (1772.000000,1782.000000,3343.000000,3353.000000,1.000000)
 2807.5 | 2808 | 2808 | (1892.000000,1902.000000,3713.000000,3723.000000,1.000000)
   1488 | 1488 | 1488 | (256.000000,266.000000,2710.000000,2720.000000,1.000000)
 2346.5 | 2347 | 2347 | (1926.000000,1936.000000,2757.000000,2767.000000,1.000000)
   1937 | 1937 | 1937 | (536.000000,546.000000,3328.000000,3338.000000,1.000000)
(5 rows)

Basically, this determines the middle of the sfti core and returns that as a float or rounds it as an int. Is this sufficient for your use case or did you want something else? I notice you solved this by calculating the centroid of the geom. This might give different results?

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

2 participants