2

I'd like to create something almost identical to this:

enter image description here

I'd like to display what languages are most spoken within each neightbourhood. My data has 6 languages. Is this possible for a novice like myself? I've put together some maps with 1 category of data (eg. population, income, etc), but never with 6 categories.

My data table looks like this: enter image description here

Is there a relatively easy way to do this? Is my data organized properly to do so? Is there a better way to represent this data? I've tried using the Random Points Inside Polygons but I can't get it to work.

Here's my error message: Traceback (most recent call last): File "C:/OSGEO4~1/apps/qgis/./python/plugins\processing\algs\qgis\RandomPointsPolygons.py", line 165, in processAlgorithm pointCount = int(value) TypeError: int() argument must be a string, a bytes-like object or a number, not 'NoneType'

Execution failed after 0.10 seconds

My data does not have lat & long for each point.

  • If you have point-data, simply use classified symbology based on the language column. – Erik May 20 at 14:56
  • Hi, Jon! Welcome to the GIS SE! Please make sure that you take the tour to get familiar with the Q&A model we follow here. A good question gives enough detail that other users shouldn't need clarification. Additionally, you should provide as much detail as possible about what you've already attempted in solving this issue yourself. For instance: when you ran random points inside polygons, what wasn't working about it? Did you simply get an output that wasn't suitable, or did it not give you anything? – JoshC May 20 at 15:00
  • Hi Josh. I was unable to produce anything. I get this error message: imgur.com/a/TGbaWb6 – Jon May 20 at 15:05
  • Is your tabular data joined to a polygon layer? What does the polygon layer attribute table look like in QGIS? – JoshC May 20 at 15:23
  • Here's an image of both. I got rid of nulls in my data table like you instructed, but it looks like it's still reading them as null when it's connected to my shape file. imgur.com/a/muKCifz. To clarify, I made sure there were no nulls in my data set. – Jon May 20 at 15:57
1

From the content of the error message, it would appear that you're trying to run the algorithm on a field which contains null values, so that's the main problem.

Open up the Field Calculator and check the box to Update existing field and select the the field you're creating your points from, which I'm assuming is the "total" field in your data.

Enter the following expression:

if( "number" IS NULL, 0, "number")

This will insert 0's in place of all the nulls, which will allow you to run the Random Points tool now.

  • I've done this, but I still get the same error message. I wonder if my data is not setup to run a dot map? I don't know how to articulate things as well as I should - I'm still relatively new to this. – Jon May 20 at 15:26
1

In Excel, re-arrange the table so that you have only one row for each Geography value. Create a column for each language, and put the number of speakers of that language in that column. Eg, convert this

enter image description here

to this

enter image description here

I did this manually, but I think you can do it automatically using something called a pivot table, as mentioned here and here.

Save the new table as a CSV. Add the new table to your QGIS project.

Join the new table to the neighborhood layer. Now you have a one-to-one relationship between table rows and neighborhood geometries.

Run Random points inside polygons once for each language category. Be sure to name each new layer with the name of the language.

  • There must be something wrong with how I'm joining the tables together. I recreated my table like you instructed. I've loaded both the shape file and the .CSV in QGIS. When I go to join, I select the shape file and join them. Then when I open the Attribute Table for my data set, the numbers appear correct. Nothing is Null. But when I run the Random Points tool it gives me the same error. – Jon May 20 at 20:20
  • There are so many different screenshots at the link you posted I'm having a hard time finding the error message. Can you please add the text of the error message to your original question? Use the edit link under the question. – csk May 22 at 1:49
  • The error message is now in the original question. – Jon May 22 at 4:31
0

The input data you have has blank cells as one of the values. QGIS uses the field you specified to add points up to the number in the field. To do this it converts the field into an integer, but it cannot convert a blank cell into an integer.

The easiest way for you to fix this is to put 0's into the blank cells of your source data.

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.