3

When using the heatmap plugin, I am getting some insanely large numbers for the cell size field when setting the radius to 5000. I know that rows and columns are related to cell size x and cell size y, but I don't know how exactly.

Anyway, when I click OK and run the plugin, I get "nan" as a layer on the raster. Check the pictures below to see what I mean.

enter image description here

enter image description here

PolyGeo
  • 65,136
  • 29
  • 109
  • 338
Chris
  • 31
  • 2
  • What's the input layer CRS? – underdark Mar 09 '15 at 20:02
  • The input layer is a set of about 300 points. It's funny, because when I first ran the tool, I got a gray map but didn't like the default values used. Then, after I went back, the defaults were set to what you see above. – Chris Mar 09 '15 at 20:22
  • That doesn't answer my question :-) – underdark Mar 09 '15 at 20:31
  • Then I am not sure what you are asking. Excuse my ignorance, but what is CRS? – Chris Mar 09 '15 at 20:46
  • 1
    CRS = coordinate reference system, should be able to find by right-clicking the layer and going to properties and checking one of the tabs. Could be geographic (something like WGS84, common for GPS points or lat/long coordinates in degrees), or projected (like UTM Zone #, coordinates are usually xy in meters). Given your xy values I'm guessing you have geographic degrees and want projected ft or m. Rows and columns define the number of pixels in the raster, while xy size determine how big one pixel is. Thus the two together can give the total size/area of the raster and is how they're related. – Chris W Mar 09 '15 at 21:19
  • From the general tab under properties, the CRS is:

    USER:100000 - * Generated CRS (+proj=tmerc +lat_0=24.33333333333333 +lon_0=-82 +k=0.9999411764705882 +x_0=199999.9999999999 +y_0=0 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=us-ft +no_defs)

    This doesn't seem right. I shouldn't be user generated. I'll try importing the points again and see what happens

    – Chris Mar 10 '15 at 14:01
  • I imported the original file of points, and the CRS is still user defined. – Chris Mar 10 '15 at 14:53
  • The original point shapefile contained about 5 years of data and 1500 points. I cut it down to only include the most recent 3 years of data, and then again split the remaining 800 points based on another characteristic. Thus I have a 304 point shapefile and a 545 point shapefile. However, it seems that the user defined CRS is the same among all 3 files. Thus, the CRS of the smaller shapefiles is using that of the large shapefile. The heatmap tool works on the large 1500 point shapefile with no problems. I need help re-defining the CRS for the smaller two subfiles. Any ideas? – Chris Mar 10 '15 at 17:03
  • What is the source of the original data? See this question regarding the custom/user thing. Basically you have a proj.4 string, but QGIS doesn't recognize it as an official/EPSG definition. It looks like it's supposed to be some Florida State Plane variant, west with US feet for units and WGS84 as the datum, but this isn't my strongest area. Be careful with 'redefining' vs reprojecting. In QGIS I believe you can reproject as part of the save process; there are questions here on that topic. – Chris W Mar 10 '15 at 21:12
  • 1
    BTW, you should edit your question using the button at the lower left of it, under the tags, to provide additional information or clarification requested in comments. You can use a comment to notify the requester you've update like this: @underdark may be able to help more now. Note you can only use one @ notification per comment. – Chris W Mar 10 '15 at 21:17
  • @ Chris W

    I can tell you that based on the .prj of the original file of 1500 points, the CRS is "NAD_1983_StatePlane_Florida_West_FIPS_0902_Feet"

    I have since tried changing my two subset point files to match this, but this causes them to disappear from the map window.

    – Chris Mar 11 '15 at 17:54
  • Can't have spaces in an @ notification. Depending on how you change them that behavior might be expected - see the redefine vs reproject link in my earlier comment. It could also be someone made that mistake before and they aren't actually in that projection, they just say they are (again, source?). What is your Project CRS? Is there another layer to verify against? I suspect the issue with name in the prj is answered at this question. Getting back to the original question, what happens if you manually enter 100 for the x/y cell size values? – Chris W Mar 12 '15 at 01:12
  • When I change the x/y cell size to 100 on the original 1500 point shapefile, the rows and columns set at 2689 and 2097 respectively. The heatmap tool then runs successfully using these values and a default radius of 8000 meters.

    When I run the heatmap on either of the two sub-files, radius default changes to 6e+306 (very large) and cell size x/y change both change to inf (also very large)

    – Chris Mar 12 '15 at 12:22
  • Also, I am reasonably sure that the original CRS is correct. I am analyzing bike crash hot spots, and as expected, crashes are concentrated around metro areas (i.e. large cities) while sparse in rural areas. I've loaded a google streetmap using the OpenLayers plugin to verify this. In other words, everything makes sense visually. – Chris Mar 12 '15 at 12:30
  • I'm not following. If you run heatmap on the sub files, you can't change the default settings? Defaults are just that, default settings. You should be able to change them. I don't know exactly how QGIS comes up with its defaults, but ArcGIS uses a specific formula (more info at this question). This formula often doesn't work because of what it's intended to do, so you usually end up changing the default cell size settings to what you want. – Chris W Mar 12 '15 at 22:19
  • I am able to change the default x/y cell size, but as you know the rows and columns are related to x/y cell size by some formula....so when I set both the x and y cell size to 100, the formula calculates the rows and columns as infinity (inf). This occurs for the two sub-shapefiles, but not with the original shapefile.

    Therefore the question becomes, is there a way to change the relationship (i.e. formula) which relates x/y cell size to rows and columns?

    – Chris Mar 13 '15 at 12:15
  • Based on the help you can't, in the plugin they're constrained to each other. It sounds like something is not right with the CRS of the two sub files and that should be redone (or edit your post to include the steps you used); alternatively as underdark's answer suggests, filter the points using the original file and run the plugin on that. Also you're specifying a radius in meters, but in theory your CRS is using feet - you may want to try changing that dropdown to 'map units'. – Chris W Mar 13 '15 at 20:22

2 Answers2

1

If you did not reproject the data at any point of the preprocessing process, you can overwrite the contents of your result Shapefile's .prj file with the original .prj file content. It's just a text file, so open in a text editor and overwrite the content.

In case you did reproject the data at some point, I suggest redoing the filtering and splitting process while paying attention to the CRS. Depending on the filtering you applied, it might even be possible to just use the original file, go to Layer Properties | General | Query and set the filter there. Then run the heatmap tool.

underdark
  • 84,148
  • 21
  • 231
  • 413
  • I did as you suggested with the .prj files to no avail. I will see if I can mess with the filtering when I split the points and then see if the heatmap will run. – Chris Mar 11 '15 at 17:50
  • 1
    So I was able to run the heatmap (finally). I took the original data, selected the points I wanted for a subset using the attribute table, and used a right click save-as to save these points as a new file by specifying the CRS as WGS 84 (I do not know why this worked, but even if it was not the original CRS, the difference between is not noticeable for my personal application) – Chris Mar 16 '15 at 18:34
0

I had a similar issues. I was able to fix them with a combination of two things.

  1. Making sure I had no data points with a value of NULL for latitude and longitude.
  2. Paying attention to the ratio of radius to cell size. If I wanted a smaller radius, I needed to reduce my cell size... by increasing my number of rows.
PolyGeo
  • 65,136
  • 29
  • 109
  • 338
Selah
  • 143
  • 1
  • 5