Attached is a patch that extends the geo_value function. It can now convert fully between wkb, wkt, and array formats. I couldn't find a spec on the array format. I assumed it was just an array with 'lat' and 'lon' keys.

CommentFileSizeAuthor
#2 converters.patch1.19 KBphayes
converters.patch1.11 KBphayes

Comments

phayes’s picture

StatusFileSize
new1.19 KB

Whoops.. Didn't test enough. Re-rolled patch. This one should be fully working

allie micka’s picture

Hey, gangbusters on all of these patches and stuff!

A big goal with all of this Geo stuff is to be completely database agnostic. This is why I have implemented an interface and two derivative subclasses: GeoSimple and GeoSQL (/GeoSQLMySQL, GeoSQLPostgreSQL).

As such, the geo() function call is deprecated and I'm seeking to eliminate its use. More importantly, we can't be making direct calls to the database and skirting the API outright.

The reason I hadn't completed this function is that I wanted to implement these functions in the GeoSimple class and/or find a similarly-clean way to cover the functionality.

Do you have any thoughts on this?

phayes’s picture

I definitely like the idea of separating things off to functions that all databases can handle, and then supporting more advanced features through an abstracted geoSQL. Obviously all regular SQL used throughout the module needs to be of the simple type.

Am I using SQL in this patch that isn't supported across all databases? I think this patch is a fairly simple one and an example of how it should be implemented using your geoSimple class would be super appreciated.

It sounds to me like I need to do a little more research on how you are separating off GeoSimple and GeoSQL, and how it should be used. Any examples?

Yeah, totally went gangbusters yesterday. I've been wanting to dive into geo stuff for a while, but haven't had the time. A lot of these patches represent my first deep dive into the geo module code, so please let me know if you think i'm missing some of the concepts you are trying to stick to.