function gis_cb_importer_points() { $json = json_decode(file_get_contents(__DIR__ . '/../data/complete_data.json'), TRUE); $set = array(); foreach($json AS $values) { $nom_fr = $values['Name']['fr']; $nom_nl = isset($values['Name']['nl']) ? $values['Name']['nl'] : $nom_fr; $polygon = array('type' => 'Feature','geometry' => $values['POLYGON']); $wkt = json_to_wkt(json_encode($polygon)); $set = array( 'titre' => '[fr]' . $nom_fr. '[nl]' . $nom_nl. '', 'lat' => $values['lat'], 'lon' => $values['lng'], 'geo' => "GeomFromText('$wkt')", 'zoom' => 11, 'type' => 'Multipolygon', 'pays' => '[fr]Belgique[nl]Belgiƫ', 'code_pays' => 'BE', 'ville' => '[fr]' . $nom_fr. '[nl]' . $nom_nl. '', 'code_postal' => $values['zip'], ); } sql_insertq_multi('spip_gis' , $set); }