3

I have a GeoDjango web service that allows a user to upload a las file (v1.2). I can derive the extent of the point cloud coverage from the file using laspy:

from django.contrib.gis.geos import Polygon
from laspy.File import File
las_file = File('some/las/file', 'r')
xmin = las_file.header.min[0]
ymin = las_file.header.min[1]
xmax = las_file.header.max[0]
ymax = las_file.header.max[1]
bbox = Polygon.from_bbox((xmin, ymin, xmax, ymax))

...from this polygon's extent I would like to know its map scale in cm:m (projection is EPSG:3857) so I can use Waldo Tobler's rule of resolution (i.e. resolution/cell size = scale/(1000*2)) to create a raster of the point cloud.

What is the best approach here? I thought maybe creating a map object that is zoomed to the poly then accessing a scale property (e.g. scale = map.scale()) would be a good method but do not know of a python API available to do this... I see that QGIS for python has a scale calculator but am not sure how to implement with my project.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.