QGIS 3.4 heatmap: how to reproject layer from degrees to meters? - maps

I'm trying to follow this youtube tutorial on making a heatmap in QGIS. However, my data is in degrees and not meters. The documentation for the data I'm using says the CRS should be EPSG:4326 - WGS 84, which is what I imported it as. Do I still need to reproject?
, but I'm trying to get meters and not degrees. The data I'm using comes from this tutorial.

If you set CRS to EPSG: 6487 - NAD83 (2011) / Maryland, you can enter value in terms of meters.

Related

Export latitude & longitude zoom 18 vector tiles filtered by roads as csv

I want to create a database of level 18 vector tiles and filter them by any type of road/transportation data.
For example:
(tile_x-tile_y-zoomlevel)
138139-86686-18 (road)
138140-86687-18 (no road -> skip)
138140-86686-18 (road)
...
CSV would look like:
138139,86686
138140,86686
I have downloaded a old planet vector map in mbtiles format, max zoom level is 14.
Now i need to slice this map into zoom level 18 tiles and loop through each tile if it contains road data.
What i have tried:
1: I have learned a bit of Python and tried to create a plugin in QGIS but i dont know how to start doing the map stuff, i cannot find any help.
2: I have set up a virtual machine running ubuntu server and try to use tilemaker
How can i slice the map to zoom 18 tiles, filter it by road data and export the result?

PDFlib=> how to set the resolution of printing paper to 300dpi

I'm new to PDFlib. when use PDFlib to create PDF.I find that the dpi of the page(paper) was 72.and I want to set the dpi to 300 for print use,but i dont know how to use PDFlib to set.
enter image description here
as flomei already mentioned the PDF format itself do not have any kind of resolution. For placing the content or specifying the page dimension PDFlib use the PDF’s default coordinate system, which use the DTP points as unit. From the PDFlib 9.2 Tutorial, chapter 3.2.1.
PDF’s default coordinate system is used within PDFlib. The default coordinate system (or default user space) has the origin in the lower left corner of the page, and uses the DTP point as unit:
1 pt = 1/72 inch = 25.4/72 mm = 0.3528 mm
When you want to address the positions with a different unit, you can scale the coordinate system. Please check out the same PDFlib Tutorial chapter, section "Using metric coordinates":
p.scale(28.3465, 28.3465);
After this call PDFlib will interpret all coordinates (except for interactive features, see below) in centimeters since 72/2.54 = 28.3465.
of course you can use further scale values.

Points in coordinates and shapefile in ft - Don't align even in same projection

I am trying to run a point-in-polygon count in QGIS. I have a shapefile of San Diego zip codes in NAD83 (2230 EPSG). I have a delimited text file of points with lat/lon coordinates.
In QGIS, I can get the points to overlay properly on the polygons in the viewer in the basic OTF projection. But I can't run the point-in-polygon count while they're in different projections. I have reprojected each file (saving the points as a shapefile) with identical projections in QGIS, but the geographies don't match up at all.
I'm assuming my issue is that the lat/lon coordinates are in degrees and the NAD83 projection is in feet. I thought that reprojecting would solve this issue though? Clearly the files can be easily read together, they show up in the right place in the viewer with the OTF projection. This only works with a default custom CRS for OTF that appears to be handling the ft/lat-lon conflict. If I save all in a WGS layer like EPSG4326 or EPSG3857 then nothing aligns.
Here is the text for the projection that is working:
* Generated CRS (+proj=lcc +lat_1=32.78333333333333 +lat_2=33.88333333333333
+lat_0=32.16666666666666 +lon_0=-116.25 +x_0=2000000 +y_0=500000.0000000001
+ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=us-ft +no_defs)
Found a question with this answered already here: https://gis.stackexchange.com/questions/13023/how-to-change-the-unit-of-measure-from-degrees-to-meters-in-qgis
Also further information here: http://urbanpolicy.net/wp-content/uploads/2014/05/TIGER_file-prep_140509.pdf

Leaflet JS: Custom 2D projection that uses meters instead of lat,long

I am working on a custom game map. This map is basically a raster image, overlayed with some paths and markers. I want to use Leaflet to display the map.
What I am struggling with, is that Leaflet uses Latitude and Longitude to calculate positions, while it uses meters for distances (path lengths, radii of circles, etc).
This is very understandable when dealing with a spherical world like our Earth, but it complicates the custom map, which is flat a lot.
I would like to be able to specify the positions in the same unit as the distances.
Now, by default Leaflet uses a Spherical Mercator projection. According to the Docs, it is possible to define your own projections and coordinate reference systems, but I have been unable to do this thus far.
How would this be possible? Or is there a simpler way?
You should take a look at the simple coordinate reference system (L.CRS.Simple) included with Leaflet:
A simple CRS that maps longitude and latitude into x and y directly. May be used for maps of flat surfaces (e.g. game maps).
You can define the CRS of your L.Map instead upon initialization like so:
new L.Map('myDiv', {
crs: L.CRS.Simple
});
Some further elaboration: As #ghybs pointed out in the comment below and the comment to your question the default sperical mercator projection (L.CRS.EPSG3857) already works in meters. When you calculate the distance between two coordinates, Leaflet returns meters, example:
var startCoordinate = new L.LatLng(0, -1);
var endCoordinate = new L.LatLng(0, 1);
var distance = startCoordinate.distanceTo(endCoordinate);
console.log(distance);
The above will print 222638.98158654713 to your console which is the distance between those two coordinates in meters. Problem is that when using spherical projection, distance between two coordinates will become less the further you get from the equator which will become problematic when creating a flat gameworld. That's why you should use L.CRS.Simple, you won't have said problem.

About finding pupil in a video

I am now working on an eye tracking project. In this project I am tracking eyes in a webcam video (resolution if 640X480).
I can locate and track the eye in every frame, but I need to locate the pupil. I read a lot of papers and most of them refer to Alan Yuille's deformable template method to extract and track the eye features. Can anyone help me with the code of this method in any languages (matlab/OpenCV)?
I have tried with different thresholds, but due to the low resolution in the eye regions, it does not work very well. I will really appreciate any kind of help regarding finding pupil or even iris in the video.
What you need to do is to convert your webcam to a Near-Infrared Cam. There are plenty of tutorials online for that. Try this.
A Image taken from an NIR cam will look something like this -
You can use OpenCV then to threshold.
Then use the Erode function.
After this fill the image with some color takeing a corner as the seed point.
Eliminate the holes and invert the image.
Use the distance transform to the nearest non-zero value.
Find the max-value's coordinate and draw a circle.
If you're still working on this, check out my OptimEyes project: https://github.com/LukeAllen/optimeyes
It uses Python with OpenCV, and works fairly well with images from a 640x480 webcam. You can check out the "Theory Paper" and demo video on that page also. (It was a class project at Stanford earlier this year; it's not very polished but we made some attempts to comment the code.)
Depending on the application for tracking the pupil I would find a bounding box for the eyes and then find the darkest pixel within that box.
Some psuedocode:
box left_location = findlefteye()
box right_location = findrighteye()
image_matrix left = image[left_location]
image_matrix right = image[right_location]
image_matrix average = left + right
pixel min = min(average)
pixel left_pupil = left_location.corner + min
pixel right_pupil = right_location.corner + min
In the first answer suggested by Anirudth...
Just apply the HoughCirles function after thresholding function (2nd step).
Then you can directly draw the circles around the pupil and using radius(r) and center of eye(x,y) you can easily find out the Center of Eye..

Resources