11

Here is what I am doing:

  1. Create a layer by uploading a shapefile into QGIS
  2. Select attributes of that file
  3. Export selected attributes with the "save only selected features" check box when I save the file

I need to export names corresponding to each polygon. Unfortunately when I save as KML file and open in Google My Maps, I can see only polygon boundaries, therefore I need to name them. The info is in a column in the attribute table.

  • REGARDING THE ISSUE OF CERTAIN FIELDS NOT SHOWING UP IN THE EXPORT I found out why some fields would not follow : their content was NULL. I put a 0 in all the fields of only one feature and all the checked fields successfully exported and now show up in the destination attribute table! So most of the data cells can be NULL, but if at least one feature contains contains a value in a specific field, it will be exported. – Olivier Jun 12 at 19:08
13

In the newest version (I used QGIS 2.18.9) if you right-click on the layer -> "Save As..." you can toggle "Select fields to export and their export options". There you can select all the fields you want to export.

enter image description here

Optional: In the Save As-window - Scroll down to "Datasource Options", you can add the selected field name to "DescriptionField" or "NameField". For example if you checked the field "ABC123" and you enter "ABC123" in the NameField, the ABC123-data will have "Name" as the collumn-title in the exportet layer.

12

I have found a solution to my issue and I would like to share it.

I managed to export attributes (up to two) in the "save as" window when saving a vector layer.

More precisely, in the "data source options" section, I have:

  • Set as "relativeToGround" the "Altitude Mode"
  • Wrote name of attribute I would like to export in the "DescriptionField" field
  • Wrote name of attribute I would like to export in the "NameField" field

You can export maximum two in this way. If you want more than you should find an alternative way

Here you can see the fields you need to fill when exporting KML file

2

The kml xml schema does not have a tag for labeling polygon features only placemarks = points. A workaround for doing this is to create a new point layer from polygon layer and in the Save vector layer as dialog define the labeling field in the NameField text box. Once you have both kml creted in GE, select File>Open to add both kml in.

Alternatively, you can edit the polygon kml/xml in a text editor and manually add in the MultiGeometry tags for each feature, see link below:

Adding Labels to Polygons

2

I have had the same problem with a layer consisting of vectors that I want to display in Google Earth with attributes. I found that I needed to save as ClampToground. Then in "Datasource Options" only put the name of the field you want as the primary display name under "NameField." Leave "Description Field" blank. Saved like that in Wein and all the fields with data come up in a table in Google Earth.

2

Google Earth will label the polygons if you follow this easy route: In "save vector layer as" and under Encoding select the dropdown at "Select fields to export and their export options" then check the boxes next to the fields you want to export to Google Earth. Next, select "ClampToGround" and under that remove text from "DescriptionField" and type in the exact name of the field (checked above) to "NameField" that you want for the in the drop-down Google Earth list.

The field you chose for the NameField will appear in your list of polygons in Google Earth and when you select the polygon the other fields will appear in a pop-up box.

1

Google does not label polygons but it does label points. In order to have a label in google earth for the Points you need to fill the column name (of your attribute table in QGIS) you want into the NameField in the save as menu from the layer within QGIS.

-1

The best way to export to kml in qgis is by using the mmqgis plugin. https://plugins.qgis.org/plugins/mmqgis/

We're looking for long answers that provide some explanation and context. Don't just give a one-line answer; explain why your answer is right, ideally with citations. Answers that don't include explanations may be removed.

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.