have this csv file and I wish to import it in my MySQL database to draw all polygons I want simply by typing a postcode. In this file I have
- the postcode
- a list of coordinates (my idea is to use all coordinates to draw an accurate polygon
- a field called 'area' (I have no idea how to use this information)
My first problem is how to parse this file to save data in my DB to have 3 columns
|postcode|latitude|longitude
Can you help with this issue please? Or suggest me a better way if you know.
Thanks.
Edit: I am trying to use this php code editing each time the string
$fname = "uk.csv";
$fhandle = fopen($fname,"r");
$content = fread($fhandle,filesize($fname));
$content = str_replace('"<MultiGeometry><Polygon><outerBoundaryIs><LinearRing><coordinates>', '', $content);
$fhandle = fopen($fname,"w");
fwrite($fhandle,$content);
fclose($fhandle);
but this file is homogeneous because not all rows start with the same string
<MultiGeometry><Polygon><outerBoundaryIs><LinearRing><coordinates>
but also with only
<Polygon><outerBoundaryIs><LinearRing><coordinates>