0

I'm using QGIS 3.10.4. I have a vector layer that contains more than 200 cities as multiple points on the layer. The attribute table has one column: city name.

My goal is to keep only 10 certain cities on the layer and remove the other 190 and put these 10 cities on a new layer.

I can manually select the city names and save the selected features into a new layer.

I was wondering if there's an easier way? For example, write a query with the target city names. Because sometimes I may have about 1000 cities, makes manual selection too time-consuming.

2

To select the cities you want, use the selct by expression function:

enter image description here

Than use an expression like city_name='New York' or city_name='Los Angeles' or city_name='London' or city_name='Paris' to select those you are interested in. If there is an easier way depends on what kind of data you have and how the seletion you want to make looks like. If you have 1000s of cities and want to hand-pick dozens or hundreds of cities by name, best write them in a table and import it as csv to QGIS, then write an expression for the selection, collecting the names from the csv.

Once selected, you can export the selected features (cities) as described by @Nick.

1

Select the features and then right click the layer and choose Export > Save Selected Features As. See here: https://www.gislounge.com/save-selection-new-file-using-qgis/

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.