Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hillshade seg map #87

Merged
merged 44 commits into from
Dec 14, 2021
Merged
Show file tree
Hide file tree
Changes from 40 commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
9083b35
added test notebbok (to be deleted later)
GwydionJon Oct 19, 2021
ed955c5
Merge branch 'reprojection_explicit_operation' into hillshade_seg_map
GwydionJon Oct 20, 2021
c122e3d
Merge branch 'reprojection_explicit_operation' into hillshade_seg_map
GwydionJon Oct 20, 2021
6085720
unified classification default value with dataset
GwydionJon Oct 20, 2021
d5fffad
fixed return spatial reference in reproject_dataset
GwydionJon Oct 20, 2021
c8a5351
added boundry detection in map
GwydionJon Oct 20, 2021
04168f1
Merge branch 'reprojection_explicit_operation' into hillshade_seg_map
GwydionJon Oct 20, 2021
67aa88b
trying different srs
GwydionJon Oct 22, 2021
ccf3824
cleaned up segmentation debug statements
GwydionJon Oct 22, 2021
eaa6470
fixed segmentation map representation and added draw control and load…
GwydionJon Oct 22, 2021
4acc736
Merge remote-tracking branch 'origin/main' into hillshade_seg_map
GwydionJon Oct 26, 2021
7a14c24
merged dataset
GwydionJon Oct 26, 2021
2e9c229
added square boundary segmentation
GwydionJon Nov 8, 2021
fda5b0c
removed old boundary segmentation from map
GwydionJon Nov 8, 2021
f3534fb
moved controls to own function
GwydionJon Nov 8, 2021
0ee356a
Merge remote-tracking branch 'origin/main' into hillshade_seg_map
GwydionJon Nov 8, 2021
fb5a736
adding hillshade to map without tempfile
GwydionJon Nov 8, 2021
eb05ce9
lowered resolution
GwydionJon Nov 8, 2021
7da41ef
added crop function for pictures
GwydionJon Nov 19, 2021
8065873
modiefied segmentation input
GwydionJon Nov 19, 2021
3df9f65
added hillshade to satelite map
GwydionJon Nov 19, 2021
79e9d1e
added trim picture and convert picture to base64url function to utils
GwydionJon Nov 19, 2021
9702227
changed load_hillshade to cache previous calculated hillshades for reuse
GwydionJon Nov 19, 2021
4c83739
load hillshaded got renamed to load_overlay and can now visualize bot…
GwydionJon Nov 19, 2021
87da227
added docstring
GwydionJon Nov 19, 2021
1249a29
added convert function
GwydionJon Dec 1, 2021
ab1f44c
removed test_map
GwydionJon Dec 10, 2021
6890e1a
added map class to replace the old Interactive map.
GwydionJon Dec 10, 2021
6f20c4d
changed import
GwydionJon Dec 10, 2021
cae55d6
added testfunction and error handling for wrong dataset or segmentati…
GwydionJon Dec 13, 2021
72ea115
Merge remote-tracking branch 'origin/main' into hillshade_seg_map
GwydionJon Dec 13, 2021
8f9dea5
changed show_map to map
GwydionJon Dec 13, 2021
fae18e5
added map from segmentation to polygon test
GwydionJon Dec 13, 2021
ee26b9d
added segmentation show to tst_show_map
GwydionJon Dec 13, 2021
8476c13
removed comment
GwydionJon Dec 13, 2021
9c5b514
removed comments
GwydionJon Dec 13, 2021
d939f48
removed unnecassary if condition
GwydionJon Dec 13, 2021
dfdf277
test_map for demonstration
GwydionJon Dec 13, 2021
0f25cbf
added pyproj to environment
GwydionJon Dec 13, 2021
0f0695f
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Dec 13, 2021
4acab82
removed test
GwydionJon Dec 14, 2021
351e3cc
added version to pillow
GwydionJon Dec 14, 2021
79cc4dd
included dominics feedback
GwydionJon Dec 14, 2021
f48bbdb
Merge remote-tracking branch 'origin/main' into hillshade_seg_map
GwydionJon Dec 14, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions adaptivefiltering/apps.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from adaptivefiltering.filter import Pipeline
from adaptivefiltering.paths import load_schema
from adaptivefiltering.pdal import PDALInMemoryDataSet
from adaptivefiltering.segmentation import InteractiveMap, Segmentation
from adaptivefiltering.segmentation import Map, Segmentation
from adaptivefiltering.widgets import WidgetForm

import ipywidgets
Expand Down Expand Up @@ -256,7 +256,7 @@ def _finalize(_):

def create_segmentation(dataset):
# Create the necessary widgets
map_ = InteractiveMap(dataset=dataset)
map_ = Map(dataset=dataset)
map_widget = map_.show()
finalize = ipywidgets.Button(description="Finalize")

Expand Down
16 changes: 0 additions & 16 deletions adaptivefiltering/dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
class DataSet:
def __init__(self, filename=None, provenance=[], spatial_reference=None):
"""The main class that represents a Lidar data set.

:param filename:
Filename to load the dataset from. The dataset is expected to be in LAS/LAZ 1.2-1.4 format.
If an absolute filename is given, the dataset is loaded from that location. Relative paths
Expand Down Expand Up @@ -52,12 +51,10 @@ def save_mesh(
classification=asprs[:],
):
"""Store the point cloud as a digital terrain model to a GeoTIFF file

It is important to note that for archaelogic applications, the mesh is not
a traditional DEM/DTM (Digitial Elevation/Terrain Model), but rather a DFM
(Digital Feature Model) which consists of ground and all potentially relevant
structures like buildings etc. but always excludes vegetation.

:param filename:
The filename to store the mesh. You can either specify an absolute path
or a relative path. Relative paths are interpreted w.r.t. the current
Expand All @@ -81,12 +78,10 @@ def save_mesh(

def show(self, visualization_type="hillshade", classification=asprs[:], **kwargs):
"""Visualize the dataset in JupyterLab

Several visualization options can be chosen via the *visualization_type* parameter.
Some of the arguments given below are only available for specific visualization
types. To explore the visualization capabilities, you can also use the interactive
user interface with :func:`~adaptivefiltering.DataSet.show_interactive`.

:param visualization_type:
Which visualization to use. Current implemented values are:
* `hillshade` for a greyscale 2D map
Expand Down Expand Up @@ -136,11 +131,9 @@ def show_interactive(self):

def save(self, filename, compress=False, overwrite=False):
"""Store the dataset as a new LAS/LAZ file

dokempf marked this conversation as resolved.
Show resolved Hide resolved
This writes this instance of the data set to an LAS/LAZ file which will
permanently store the ground point classification. The resulting file will
also contain the point data from the original data set.

:param filename:
Where to store the new LAS/LAZ file. You can either specify an absolute path
or a relative path. Relative paths are interpreted w.r.t. the current
Expand Down Expand Up @@ -181,10 +174,8 @@ def save(self, filename, compress=False, overwrite=False):

def restrict(self, segmentation=None):
"""Restrict the data set to a spatial subset

:param segmentation:
:type: adaptivefiltering.segmentation.Segmentation

"""
from adaptivefiltering.pdal import PDALInMemoryDataSet

Expand All @@ -194,12 +185,10 @@ def restrict(self, segmentation=None):

def provenance(self, stream=sys.stdout):
"""Report the provence of this data set

For the given data set instance, report the input data and filter
sequence (incl. filter settings) that procuced this data set. This
can be used to make good filtering results achieved while using the
package reproducible.

:param stream:
The stream to write the results to. Defaults to stdout, but
could also e.g. be a file stream.
Expand All @@ -218,11 +207,9 @@ def convert(cls, dataset):

def remove_classification(dataset):
"""Remove the classification values from a Lidar dataset

Instead, all points will be classified as 1 (unclassified). This is useful
to drop an automatic preclassification in order to create an archaelogically
relevant classification from scratch.

:param dataset:
The dataset to remove the classification from
:type dataset: adaptivefiltering.Dataset
Expand All @@ -248,13 +235,10 @@ def remove_classification(dataset):
def reproject_dataset(dataset, out_srs, in_srs=None):
"""
Standalone function to reproject a given dataset with the option of forcing an input reference system

:param out_srs: The desired output format in WKT.
:type out_srs: str

:param in_srs: The input format in WKT from which to convert. The default is the dataset's current reference system.
:type in_srs: str

:return: A reprojected dataset
:rtype: adaptivefiltering.DataSet
"""
Expand Down
2 changes: 1 addition & 1 deletion adaptivefiltering/pdal.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ def convert(cls, dataset):
spatial_reference=spatial_reference,
)

def save_mesh(self, filename, resolution=2.0, classification=asprs["ground"]):
def save_mesh(self, filename, resolution=2.0, classification=asprs[:]):

if os.path.splitext(filename)[1] == ".tif":
filename = os.path.splitext(filename)[0]
Expand Down
Loading