IRC logs for #farmOS, 2022-01-17 (GMT)

2022-01-16
2022-01-18
TimeNickMessage
[20:53:33]<paul121[m]>ACTION uploaded an image: (53KiB) < https://libera.ems.host/_matrix/media/r0/download/matrix.org/EXbxWaujDfO... >
[20:54:59]<paul121[m]>xc skiing amongst and under center pivots today 😁
[20:56:50]<paul121[m]>Have a seasonal ski trail throughout your field.. special geometry edge case?
[21:23:58]<symbioquine[m]><symbioquine[m]> "Alright, no worries. I'll see..." <- Interestingly, geoPHP is failing to detect the format of the WKB data and returning `FALSE`... (Hitting [this case](https://github.com/phayes/geoPHP/blob/685562416ec6d22b9b3927e02ca0ddacf8...))
[21:24:04]<symbioquine[m]>Haven't figured out why yet.
[05:10:34]<mstenta[m]>> Oh yes they should!
[05:10:34]<mstenta[m]>symbioquine fyi i fixed these docs
[05:10:46]<mstenta[m]><paul121[m]> "xc skiing amongst and under..." <- wow! how deep is that snow??
[05:14:41]<mstenta[m]><symbioquine[m]> "Interestingly, geoPHP is failing..." <- huh. weird. what is the first character of your WKB? based on that function it looks like it's expecting a `1`...
[05:14:45]<mstenta[m]>ACTION sent a code block: https://libera.ems.host/_matrix/media/r0/download/libera.chat/9ceda65da6...
[09:46:17]* farmBOT has joined #farmos
[11:18:18]<symbioquine[m]><mstenta[m]> "huh. weird. what is the first..." <- Interestingly, the first 11 bytes of the WKB I'm looking at right now are; `00 00 00 00 03 00 00 00 01 00 00` - which, based on the [WKT(B) wiki page](https://en.wikipedia.org/wiki/Well-known_text_representation_of_geometry...), means it's in big endian format...
[11:23:43]<mstenta[m]>Oh huh... I just ran a query on my local v1 db and they all seems to start with `01`
[11:23:46]<mstenta[m]>ACTION uploaded an image: (15KiB) < https://libera.ems.host/_matrix/media/r0/download/matrix.org/IvEEhdSomXN... >
[11:25:24]<symbioquine[m]>Care to share that query? 😄
[11:25:58]<mstenta[m]>`SELECT * FROM field_data_field_farm_geofield;`
[11:26:23]<mstenta[m]>or `SELECT field_farm_geofield_geom FROM field_data_field_farm_geofield;` if you just want the geom column
[11:27:08]<mstenta[m]>(that screenshot was taken from PHPStorm's query console UI)
[11:27:54]<symbioquine[m]>Ah, must be PHPStorm doing the nice printing :(
[11:28:21]<symbioquine[m]>`SELECT HEX(field_farm_geofield_geom) FROM field_data_field_farm_geofield;` seems to work...
[11:28:23]<mstenta[m]>yep
[11:28:40]<mstenta[m]>ah there ya go
[11:29:53]<mstenta[m]>wonder if GeoPHP just doesn't support big endian? i did this search... maybe some clues? https://github.com/phayes/geoPHP/search?q=endian&type=issues
[11:38:08]<symbioquine[m]>Yeah, it looks like I only have 11 geometries in my DB with little endian WKB :(
[11:38:30]<mstenta[m]>Aw weird
[11:38:59]<mstenta[m]>And the big endian geometries show properly in v1 UI?
[11:39:00]<symbioquine[m]>And 958 with big endian
[11:39:28]<mstenta[m]>Bizarre. I don't know what would cause that. Could it be some lower level database configuration?
[11:40:15]<symbioquine[m]>Yeah, or even maybe some custom tooling of mine... I'm just surprised that so much of the data is that way.
[11:40:30]<symbioquine[m]>I would have expected more of a mix.
[11:41:39]<mstenta[m]>I've never dealt with this before. Is it possible to run an update query to convert them?
[11:42:13]<mstenta[m]>Oh could it be related to WFS operations from QGIS?
[11:44:01]<symbioquine[m]>Maybe, but it seems unlikely. As I recall, most of my geometries I mapped via my earlier WFS proxy which used the farmOS API
[11:45:30]<symbioquine[m]>In case it's helpful to other folks, the query I'm using to see the big endian geometries in my 1.x (MariaDB) DB is `SELECT entity_type, entity_id, SUBSTR(HEX(field_farm_geofield_geom), 1, 20) FROM `field_data_field_farm_geofield` WHERE SUBSTR(HEX(field_farm_geofield_geom), 1, 2) = '01'; `
[11:49:23]<symbioquine[m]>symbioquine[m]: or rather that one shows the little endian ones :) it's `= '00'` at the end to show the big endian ones
[11:49:53]<symbioquine[m]><mstenta[m]> "I've never dealt with this..." <- I'd imagine :)
[11:50:05]<symbioquine[m]>I guess I'll have to figure that out
[12:20:05]<symbioquine[m]><mstenta[m]> "And the big endian geometries..." <- I think so
[12:23:47]<symbioquine[m]>Yeah, they all seem to show up correctly in 1.x
[12:24:22]<mstenta[m]>interesting - well maybe the geofield code doesn't care either way
[12:24:23]<symbioquine[m]>I'm guessing it's delegating to the geos library which maybe does support both endian-nesses
[12:24:26]<mstenta[m]>but geophp does
[12:24:49]<mstenta[m]>oh maybe geos plays a role too yea
[12:24:53]<mstenta[m]>lots of layers :-)
[12:24:58]<symbioquine[m]>yeah
[12:25:01]<mstenta[m]>geos / geophp / geofield
[12:32:17]<symbioquine[m]>I think in 1.x it may be loading via https://git.drupalcode.org/project/geofield/-/blob/7.x-2.x/geofield.modu... but I don't see the equivalent code path (to delegate to geos) in the 8.x-1.x version of geofield.
[12:34:27]<symbioquine[m]>Which I think could mean that data encoded/written on a big endian system via geos, (even with the vanilla farmOS docker container) might not migrate/display correctly in 2.x.
[12:36:42]<symbioquine[m]>That said, I think that should be a pretty rare scenario.
[12:37:23]<mstenta[m]>Ok yea I'm curious what might have caused big-endian usage in your db
[12:38:11]<mstenta[m]><symbioquine[m]> "Maybe, but it seems unlikely. As..." <- was the WFS proxy writing binary data directly to that db column?
[12:38:35]<symbioquine[m]>I think I must have written a lot of the data via the python package `geomet` which seems to be writing the data as big-endian.
[12:38:44]<mstenta[m]>ahh ok
[12:38:49]<symbioquine[m]>mstenta[m]: The proxy used the farmOS APIs
[12:38:54]<mstenta[m]>oh ok
[12:39:44]<symbioquine[m]>The more recent WFS contrib module of mine uses the php entity API so that should be okay too.
[16:09:55]<symbioquine[m]>FYI: https://farmos.discourse.group/t/rewriting-farmos-1-x-geometry-wkb-to-be...