This site has been archived and you can no longer log in or post new messages. For up-to-date community resources please visit

eZ Community » Forums » Setup & design » [solved] Import massive gmaplocation...

[solved] Import massive gmaplocation with data_import

[solved] Import massive gmaplocation with data_import

Thursday 27 November 2014 11:30:13 am - 4 replies

Hi to all,

I'm looking for a way to import massive (more than 10 000)  geolocatisation place.

I've install the extension import_data ( wich work very nicely indeed ), I use the last version of class attribute ezgmaplocation and my EZ-Publish version is Community Project 2013.11

To import my data, I've setup a csv handler to parse my CSV source file and that's work : he is parsed but I can't import my lattitude, longitude and adressse in my gmaplocation attribute.

As I read in this thread, gmaplocation object have a "fromsting" method and the CSV handlers should only give a string like:


But it doesn't work...
So I tried to hack the function save_eZ_attribute in ImporOperator.php from data_import extension with this code :

case 'ezgmaplocation':

    $value = $this->source_handler->getValueFromField();
    $attributeId    = $contentObjectAttribute->ID;
    $content         = $contentObjectAttribute->content();
    $version        = $content->attribute("contentobject_version") +1;

    // creation de l'objet gmap
    $l_TAB_Values    = explode("|", $value);
    $l_OBJ_Map    = eZGmapLocation::create($attributeId, $version, $l_TAB_Values[1], $l_TAB_Values[2], $l_TAB_Values[3]);
    $contentObjectAttribute->setContent( $l_OBJ_Map );
    $contentObjectAttribute->setAttribute( 'data_int', 1 );

    $content         = $contentObjectAttribute->content();


But this dosn't work either...

Last precision :

  • All my objects ( in wich I add the gmaplocation attribute ) are existing and there gmaplocation attribute has no content.
  • When I import my data, all the gmaplocation attribut I've previously manually entered are erased and nothing is displayed ( content go back to NNULL ).

Any help will be great.

Modified on Saturday 29 November 2014 10:43:05 am by Peretjatko Alexandre

Friday 28 November 2014 10:12:08 am

I dont know data_import very well, but you might want to give sqliimport a try:

Friday 28 November 2014 10:19:16 am

Thanks for your replie Patrick, but I use import_data for other reason in this project, so I don't want to have lots of differrents import tools to manage.

In otherwith your extension looks great I will think about it for an other project I have in mind.


Friday 28 November 2014 4:11:39 pm

HI Peretjatko, do you know that the values that you expect are going to theeZGmapLocation::create function?

have you checked if they are going into the ezcontentattribute table?

SELECT * FROM `ezcontentobject_attribute` where data_type_string = "ezgmaplocation"

And at the right version number with the corresponding id in the ezgmaplocation table?

You do have the ezgmaplocation table in your database, right?

Are there no errors being thrown in the var/log files?

It sounds like - since you are overwriting hand-entered values - that empty values are being written to the database.  But it's possible that it's just that the version number between the content object is going off compared to the version being written to the ezgmaplocation table.
I think the only way to figure out what's going on is to take a look at what's in the database.

Saturday 29 November 2014 10:41:52 am

Hi Steven,

My problem with my code is that the version was wrong !

I've change my way to import my data and I use the theeZGmapLocation::fromstring() function who expect value separated with |#

I has to format my data like :


And that's work find now !

I diddn't understood what was wrong for my first trie ( I've already tried this solution, but as I said it didn't work ... 8-)  )I probably done too many code manipulated and break and "un-break" something...

Thanks to you Steven, I've understood how to search in the ezcontentattribute table.

Take care



You must be logged in to post messages in this topic!

36 542 Users on board!

Forums menu

Proudly Developed with from