While this module has a lot of great features, it seems like overkill for the use case of simply storing a location as a lat/lon pair. However, setting up just a pair of float fields means that there is no programmatic way to identify that pair as geo data.

I see that http://drupal.org/project/location has a 7.x version, but only a dev version and seems the field API rewrite is in the works.

Would you suggest trying to use location for a simple lat/lon data field? Have you considered splitting out the widget for just the lat/lon pair as something that can be used separately?

Comments

nod_’s picture

I'd say what's the issue ? unless your dataset is huge you won't see the difference between 18 and 9 columns, most of the extra columns being floats. Sure it could be slimer if you only use lat/lon but I don't think the tradeoff is worth it.

Maybe brandonian could clear that up for you better than me.

By widget you mean the actual js map that fill in values ? If yes the openlayers version of the widget will be like that soon.

zzolo’s picture

Hey @pwolanin, good point. But I would be curious what "overkill" is. Is it more columns? more data? more choices?

The module provides a widget for just lat/lon pair if thats your preferred way to enter data.

I suppose it may be a little too much code/data for that simpler use case, but you gain so much from it, that would be a huge pain if wanted to migrate or integrate with other things later.

pwolanin’s picture

The overkill is the amount of code in this module (plus installing the external library) if I just want a simple lat/lon input.

The use case I have in mind is indexing one or more lat/lon values for each node (or other entity) for geo search. It would be much easier to have a field type that I can automatically identify in the indexing code.

nod_’s picture

I guess this one won't do for you then. I don't really see how you can split it up to have lat/lon and the rest as a pluggable module without making it bigger than it is. So you're stuck with location or a custom module if you don't want the overhead.

Maybe you have an idea about how to go ?

pwolanin’s picture

Does the geofield always populate the lar/lon values in the table (e.g. from the centroid if it's a shape)?

It probably wouldn't be hard ot add support for both geofield and locaiton, I was just hoping there was somethign a half step more advanced than just 2 separate float fields for lat/lon (which is an option for setting position for open layers, but there is no programmatic way to tell that except I guess peeking into the open layers settings).

Brandonian’s picture

@pwolanin, yes, whenever data is saved, geofield populates all the various metadata for the location. Lat/lon values are based on the centeroid of the current feature.

In general, I'm sensitive to critiques of geofield being too difficult/complex for simple application. The module, after all, does require the Libraries module and an additional php library to do anything functional. For any non-trivial display work, it also really needs the Openlayers module as well, which has its own stack of dependencies. I've done a lot of work on 7.1 to help simplify the usage of the module, and hope to make much more progress in 7.2.

Back to your use case, though. :-) I would strongly recommend this module over location mainly due to stability and developer interest issues. Geofield has a great widget for lat/lon entry, supports imports from the Feeds module, and pretty good integration with the Search API and Solr. Dev work on Location, from what I can tell, has stalled considerably, and Location's maintainer (bdragon) has lost interest in the module. There's some interesting discussion at Location for future plans (#1346746: Roadmap for next gen location (7.x-5.x)), though, so that's worth checking out.

If you decide to roll your own for your use case, I'd love to hear what successes and pitfalls you run into during development. I'm usually around on IRC during the work week (Brandonian), so feel free to hit me up anytime.

phayes’s picture

Status: Active » Closed (won't fix)

I'm going to mark this as won't fix as the orignal request was for "splitting out the widget for just the lat/lon pair as something that can be used separately". This is something we, considering the above conversation, will not do. :-)

Feel free to re-open if you have more comments.

webavant’s picture

Status: Closed (won't fix) » Active

Is it possible to use two existing text fields as lat/long? The geocoding is already done with this data. Would putting them in a Location field work?

phayes’s picture

Webavant,

If you have them in two fields already then why do you need geofield?

webavant’s picture

To be honest, I'm not sure. I'm not fully able to understand the purpose of Geofield based on the description on the project page, and I can't seem to find a way to make OpenLayers see my lat/long field.

phayes’s picture

Hi @webavant,

Check out the OL Locator Feature (http://drupal.org/project/ol_locator) - it might provide a good example of how to all the different pieces fit together.

webavant’s picture

My solution is that I stored my existing lat/long fields into geofield from a presave function. Works fine. Thanks.

Brandonian’s picture

Status: Active » Closed (won't fix)

Closing ticket.