I want to export my layer from QGIS as a CSV to import it into google fusion tables. The problem is the qgis export for the geography column is in the wrong format for what google wants.

QGIS exports the column like this:

POLYGON ((-89.286886718442915 43.036071759682343 0,-89.286884882780711 43.03590714097303 0 [...etc...] ))

But the format Google Fusion Table wants is:

<Polygon><outerBoundaryIs><LinearRing><coordinates>-89.29512225140348,43.03848368749686,0 -89.29421212623849,43.03849391491957,0 [...etc.]   </coordinates></LinearRing></outerBoundaryIs></Polygon>

Is there a way to build a custom CRS to export the data in that format? Alternatively, maybe I need some REGEX to swap out the beginning/ending text and also replace the "," and " " for each line?

Not sure what the best way forward is.

  • This is not a CRS problem. It looks like Google Fusion is expecting KML files - maybe you should try saving your data as KML instead of csv? – SAnderka Oct 7 '14 at 15:52
  • Welcome to GIS@SE .. Looks like KML to me as well. CRS has to do with the Coordinate Reference System, not the data formats. You might want to edit your question to reflect this .. – Mark Cupitt Oct 7 '14 at 15:59
  • You are absolutely right. KML was the solution. Thanks all! – user3773291 Oct 21 '14 at 0:54
  • 1
    @SAnderka I recommend that you write your comment up as an answer of a few sentences so that it can earn you some reputation as a reward. – PolyGeo Oct 21 '14 at 0:59

Hm, ok, let's make a proper answer from my comment:

Google Fusion allows you to import data from a number of sources, including csv and kml. But as far as I understand, it only understands plain data tables during csv-import. When you exported your geometry as a csv-file, QGIS used the Well-Known Text-Format to represent it in one of your table's fields (but Fusion won't interpret this as geometry). This page also specifies that you should use KML to store polygons/geodata.

Just for completeness (and this is how I answered your question), the code snipped you posted above clearly is a bit of KML-code, e.g. as seen here or here.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.