Google Latlng Lookup
ExpressionEngine 2
Back to this add-on's main page
View Other Add-ons From No Two The Same
Doing a bulk import
Bug Report
heaversm
|
Posted: 27 November 2012 01:30 PM |
|
|
|
Hi - I’m trying to import data for about 7500 records into this field (using this: http://brandnewbox.co.uk/products/details/datagrab) - and everything but the data for this field imports. I was wondering if you might clarify for me how the data for this field type is stored and what, if anything, I can do to get this to import. I am creating a csv file where, for the latlng lookup field, I have an entry of with the store name | latitude | longitude, for example “storename|43.76|-43.34” but the field ends up blank, except for the pipe characters. Anyway, awesome tool, thanks for making it available.
|
|
|
Elliot Lewis
|
Posted: 27 November 2012 02:51 PM |
# 1
|
|
Developer
|
Whoa, that’s a big import! If DataGrab insert straight in to the DB it should be fine.
The data is stored is in a simple format: pipe delimited text.
e.g. address | latitude | longitude
WC2N 5DN|0.029407|0.092998
|
|
|
heaversm
|
Posted: 27 November 2012 03:25 PM |
# 2
|
|
|
Hey - I found a way to do it. I think (maybe because it is xhtml(?) - the way to import the data is to create a standard text field for the address|lat|long data with xhtml formatting, do an import of all your data, then switch the data type to your field type, and the addresses stick. If you try to do an import while the data type is google latlng, it won’t work. Thanks again for the addon!
|
|
|
Elliot Lewis
|
Posted: 27 November 2012 03:54 PM |
# 3
|
|
Developer
|
Sounds like DataGrab doesn’t ‘understand’ what to do with the field type, but as it’s just text, what you’ve done is definitely a way to get around it. No probs, good luck.
|
|
|
heaversm
|
Posted: 27 November 2012 06:58 PM |
# 4
|
|
|
Just out of curiosity - why does the plugin store everything to one DB field. We’re actually having problems now with the google maps implementation because the api needs to query the latitude and longitude of all potential markers as separate coordinates relative to the current coordinates, and it cannot do so if those coordinates are combined in the DB.
|
|
|
Elliot Lewis
|
Posted: 06 December 2012 10:12 AM |
# 5
|
|
Developer
|
Because that’s how EE works to my understanding. All field types store data in 1 database field. The only other option is to roll your own table, which is overkill for such a simple fieldtype.
Depending on how you’re accessing the data it should be no problem to query the lat, lng separately (I’ve done it). Through EE the fieldtype supports returning just the Lat or Lng:
{geo_address:latitude}
If you’re building a custom addon, the structure is simple and 3 lines of code will get it in PHP:
$results = $this->EE->db->query("SELECT field_id_X FROM exp_channel_data WHERE entry_id=N"); $geo_data = explode('|', $results->row('field_id_X')); $latitude = $geo_data[1];
|
|
|