title: importing polygon from json file to mysql using PHP
body: <p>I'm trying to import a large amount of parsed JSON files ( 4 gb). I want to insert it al in a mysql database for QGis. At first i thought i could import everything directly with mongodb and RazorSQL, but that was impossible.  I've discovered that there's no  fast way to do it than making a script to process everything seperately :</p>
  
  <pre><code>  "pandgeometrie": {
              "type": "Polygon",
              "coordinates": [
                  [
                      [199801.469, 483101.581],
                      [199787.101, 483102.676],
                      [199786.139, 483090.053],
                      [199800.507, 483088.957],
                      [199801.469, 483101.581]
                  ]
              ]
          }
  "geometry": {
          "type": "Point",
          "coordinates": [199793.932, 483095.516]
      }
  </code></pre>
  
  <p>I want to import this data using PHP
  I thought if the polygon is combined to one line of polygon information, it would be possible to query it to MYSQL. I did it like this: </p>
  
  <pre><code>    $constants = get_defined_constants(true);
      $json_errors = array();
      foreach ($json  as $name-&gt;features =&gt; $value) {
              foreach ($value as  $var){
                  $id = $var-&gt;id; 
                  $coordinates =  $var-&gt;properties-&gt;pandgeometrie-&gt;coordinates;
                  $long = $var-&gt;geometry-&gt;coordinates[0];
                  $lat = $var-&gt;geometry-&gt;coordinates[1];
                  $point = "POINT(". $long . " ". $lat. ")";
                  var_dump($point);
                          foreach ($coordinates as  $var){
  
  
                                  echo "&lt;div&gt;";
                                  $arrPoly= array()  ;
                                          foreach ($var as  $var2){
  
  
                                                  $V0 = strval($var2[0])  ;
                                                  $V1 = strval($var2[1]);
                                                  $Comb = $V0 ." ". $V1;
                                                  array_push($arrPoly, $Comb);
  
                              }
                                  $polyImplode = implode($arrPoly, ",");
                                  $polygon = "POLYGON((".$polyImplode."))";
                                  var_dump($polygon);
  
  
  $query = "INSERT INTO  geometry VALUES(PolygonFromText('$polygon'),'$id',PointFromText('$point'))"; 
  </code></pre>
  
  <p>When checking the values I get only NULL values back. </p>