I Have an *.sql file that has no spatial information. For every record there is an id. I also have a Qgis project with polygons without any id. How can i connect the polygons with the database? I know that i have to add the same id to the shapes to make the connection. I don't know how to make the connection. Is there any tutorial that can help me?

  • If you dont have ids , you cannot join them. You can open attribute table , add corresponding to polygon and use properties to map relations by hand and then using layer properties (Join) to map polygons to table (or just use create spatial table which has joined shape and attribute table) – simplexio Mar 10 '14 at 11:05

Just, 1. add vector layer --> database--> Type-->MySQL --> connection-->New 2. complete the parameters 3. test the connection 4. import the layer(s) you want 5. add id(s) to shape's attribute tables--> join.


Just load your data into QGIS and use the tool called "Join attributes by location". According to the doc :

Join additional attributes to vector layer based on spatial relationship. Attributes from one vector layer are appended to the attribute table of another layer and exported as a shapefile.

You need to install the ftools extension.

I guess you already have MySQL server running and you already know how to import your MySQL data.

  • The problem is that the database has no spatial information. – Παύλος Αποστόλου Mar 10 '14 at 16:50
  • In that case, you should probably change "I Have an *.sql file that has information about polygon areas." by "I Have an *.sql file that has NO information about polygon areas. and I'm scared there is no automatic way to do it – simo Mar 10 '14 at 16:54

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.