< 162022-01-17⋎18 >

Topic for #farmOS is: farmOS (farmos.org) is a free and open source, web-based farm management system. User guide: farmos.org/guide/ - Forum: farmOS.discourse.groupSet by mstenta on 2021-06-15 at 12:52
01:53*uploaded an image: (53KiB) < libera.ems.host/_matrix/media/r0/downloa >
01:54paul121[m]xc skiing amongst and under center pivots today 😁
01:56paul121[m]Have a seasonal ski trail throughout your field.. special geometry edge case?
02:23symbioquine[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](github.com/phayes/geoPHP/blob/685562416e))
02:24symbioquine[m]Haven't figured out why yet.
10:10mstenta[m]> Oh yes they should!
10:10mstenta[m]symbioquine fyi i fixed these docs
10:10mstenta[m]<paul121[m]> "xc skiing amongst and under..." <- wow! how deep is that snow??
10:14mstenta[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`...
10:14*sent a code block: libera.ems.host/_matrix/media/r0/downloa
14:46*farmBOT has joined
16:18symbioquine[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](en.wikipedia.org/wiki/Well-known_text_re), means it's in big endian format...
16:23mstenta[m]Oh huh... I just ran a query on my local v1 db and they all seems to start with `01`
16:23*uploaded an image: (15KiB) < libera.ems.host/_matrix/media/r0/downloa >
16:25symbioquine[m]Care to share that query? 😄
16:25mstenta[m]`SELECT * FROM field_data_field_farm_geofield;`
16:26mstenta[m]or `SELECT field_farm_geofield_geom FROM field_data_field_farm_geofield;` if you just want the geom column
16:27mstenta[m](that screenshot was taken from PHPStorm's query console UI)
16:27symbioquine[m]Ah, must be PHPStorm doing the nice printing :(
16:28symbioquine[m]`SELECT HEX(field_farm_geofield_geom) FROM field_data_field_farm_geofield;` seems to work...
16:28mstenta[m]yep
16:28mstenta[m]ah there ya go
16:29mstenta[m]wonder if GeoPHP just doesn't support big endian? i did this search... maybe some clues? github.com/phayes/geoPHP/search?q=endian
16:38symbioquine[m]Yeah, it looks like I only have 11 geometries in my DB with little endian WKB :(
16:38mstenta[m]Aw weird
16:38mstenta[m]And the big endian geometries show properly in v1 UI?
16:39symbioquine[m]And 958 with big endian
16:39mstenta[m]Bizarre. I don't know what would cause that. Could it be some lower level database configuration?
16:40symbioquine[m]Yeah, or even maybe some custom tooling of mine... I'm just surprised that so much of the data is that way.
16:40symbioquine[m]I would have expected more of a mix.
16:41mstenta[m]I've never dealt with this before. Is it possible to run an update query to convert them?
16:42mstenta[m]Oh could it be related to WFS operations from QGIS?
16:44symbioquine[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
16:45symbioquine[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'; `
16:49symbioquine[m]symbioquine[m]: or rather that one shows the little endian ones :) it's `= '00'` at the end to show the big endian ones
16:49symbioquine[m]<mstenta[m]> "I've never dealt with this..." <- I'd imagine :)
16:50symbioquine[m]I guess I'll have to figure that out
17:20symbioquine[m]<mstenta[m]> "And the big endian geometries..." <- I think so
17:23symbioquine[m]Yeah, they all seem to show up correctly in 1.x
17:24mstenta[m]interesting - well maybe the geofield code doesn't care either way
17:24symbioquine[m]I'm guessing it's delegating to the geos library which maybe does support both endian-nesses
17:24mstenta[m]but geophp does
17:24mstenta[m]oh maybe geos plays a role too yea
17:24mstenta[m]lots of layers :-)
17:24symbioquine[m]yeah
17:25mstenta[m]geos / geophp / geofield
17:32symbioquine[m]I think in 1.x it may be loading via git.drupalcode.org/project/geofield/-/bl but I don't see the equivalent code path (to delegate to geos) in the 8.x-1.x version of geofield.
17:34symbioquine[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.
17:36symbioquine[m]That said, I think that should be a pretty rare scenario.
17:37mstenta[m]Ok yea I'm curious what might have caused big-endian usage in your db
17:38mstenta[m]<symbioquine[m]> "Maybe, but it seems unlikely. As..." <- was the WFS proxy writing binary data directly to that db column?
17:38symbioquine[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.
17:38mstenta[m]ahh ok
17:38symbioquine[m]mstenta[m]: The proxy used the farmOS APIs
17:38mstenta[m]oh ok
17:39symbioquine[m]The more recent WFS contrib module of mine uses the php entity API so that should be okay too.
21:09symbioquine[m]FYI: farmos.discourse.group/t/rewriting-farmo

< 162022-01-17⋏18 >