1

I have two shapefiles:

  • one with various points of Hospitals across Los Angeles
  • another of the LA census tracts.

I want to merge the two layers together to create one layer with all of that data together. I want to be able to click on individual tracts on the map and see that tract's info, as well as be able to click on the points inside that are contained within the tract (as well as be able to click on those points).

I am using QGIS. I'm not sure what the right move is.

How can I do this?

Taras
35.8k5 gold badges77 silver badges152 bronze badges
asked May 31, 2021 at 20:12
6
  • 2
    You can not merge points and polygons that way in one layer. You can only join them by 1:n where 1 is a polygon with n points aggregated (array, concatenated string, sum, mean, ... of the point attributes) or by joining 1:1 where each point gets the values of the polygon it is covered by. Which of these two options do you prefer? Commented May 31, 2021 at 20:26
  • You don't even have to join - a spatial query would do the job. You could create a virtual field (attribute) based on such a query or a virtual layer. Commented May 31, 2021 at 20:46
  • @Babel Sorry, I don't quite understand. Could you explain a little more? Commented May 31, 2021 at 21:42
  • Well, you could use QGIS expressions to create a virtual field that calculates dynamically a spatial relationship between two layers like every point should get the attribute information from the polygon it is inside. See here for an example, where the point-layer gets an information from the line layer the points lay on: gis.stackexchange.com/a/398092/88814 - If the field is a virtual one (create it with field calculator), the content will update when you make changes. Virtual layers offer a similar way, but with SQL-like queries. Commented May 31, 2021 at 21:54
  • 1
    Of course I do, @Taras Commented Jun 1, 2021 at 5:45

0

Know someone who can answer? Share a link to this question via email, Twitter, or Facebook.

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.