# [postgis-users] PostGIS as a solution for non-geographic x-y or temporal data ?

Rémi Cura remi.cura at gmail.com
Thu Aug 28 00:59:52 PDT 2014

```What I meant about (time,[-88,88]) --> X,Y is that a tone is very similiar
to the same tone one octave up and one octave down.
This introduces problems because your tone space is not flat (like [1,88]).
Therefore you may want to models this using a third dimension.

However you can somehow only use 2D and introduce this octave knowledge in

for the time I wouldn't discretize it (convert to int), because in
classical music for instance the tempo is constantly fluctuating during all
the play
, so if you define time has regularly spaced notes, your going to loose a
lot's of knowledge. Moreover, you have nothing to gain by doing this. All
PostGis function work on X as a float (double in fact).

What this modelisation is going to do is exactly what you would obtain if
you draw a line between the note on the score (the behavior of what you
want is not clear for chords tough).

I did use PLR,
it works very well and is very handy.
I would recommend writting the R in RStudio with fake data for test, then
port it to PL/R.
Be carefull wrong operation may crash the server at first.

I did clustering, which you could also do on your not as X,Y points. For
this you need a measure of distance, you can simply take euclidian distance
(regular postgis distance) for a start.

Cheers,
Rémi-C

2014-08-27 18:38 GMT+02:00 Lee R <sregdoreel at gmail.com>:

>
> On Monday, August 25, 2014 4:46:11 AM UTC-4, Rémi Cura wrote:
>>
>> You want to map your dimension
>> (time, note_pitch) to (X,Y) ?
>>
>> It seems really difficult to achieve if for instance you would consider a
>> C and a C up an octave closer than a C and a D.
>>
>> And if you consider
>> (time,note_pitch) to (X=time, Y = [A-G], Z = [1-8]) ,
>> Lot's of function in postgis doesn't work well with Z.
>>
>
> Fortunately we can map musical notes as 1-12 instead of A - G, or for that
> matter 1-88.  As "vectors" the notes can range from -88 to 88 (keys on the
> piano), bounded somewhat by abs( vector1+vector2+vector3 ) <= 88.
>
> In other words instead of an X,Y coordinate system, a musical note is 1
> dimension (y), time the 2nd dimension (x). Analyzed as a directed path
> (geometrically left to right .. ) the query would be analyzing time instead
> of a physical "x" coordinate (i.e. longitude).
>
> So if "X" is time & "Y" is pitch, can I quantize time by arbitrarily
> discrete amounts & still get usable results? Say for example we establish
> the 1/32nd note as being the smallest duration, then everything would be an
> integer multiple of that. It's surely not a perfect model, but a cartesian
> reduction of a certain problem for quick analyses.
>
> An example of what I'm thinking: Using multilines, it could be possible to
> observe where a melody & it's counterpoint harmony cross over. Or draw a
> chord as a polygon & see where a melodic line crosses through it.
>
> I wondering what other types of metrics I can derive from a cartesian
> geometry?
>
> For instance, I gather PostGIS can find polylines ranked by similarity? If
> so this could be superior to my trigram dictionary attack method, or
> bothering with an FP-Growth algorithm.
>
> > Moreover, distance between geometry (serei of not ein your case) in
> postgis are rather limited to
> > _what you can come up with
> > _*ST_HausdorffDistance*()
> > (you could use R to create your own distances)
>
> TY for the pointer.
>
> I'm very much considering using R as a stored procedure language to work
> over these data.
>
>
> > I'm not an expert but lots of work in GIS rearch is devoted to time
> serie, mainly GPS trace (X,Y,Z,timestamp).
> > It seems that Grass GIS has a module for it :
> http://grasswiki.osgeo.org/wiki/Time_series
>
> Yeh, that's the USACE GIS db. Another thing to look into... :)
>
> Thanks!
>
> --Lee
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20140828/fb6ac12c/attachment.html>
```