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

python-bindings for MoveTK #17

Open
wants to merge 29 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
1db29cd
Add CmakeLists to build sources for python bindings
aniketmitra001 Sep 25, 2020
6b84358
Install PyBind11 as a dependency
aniketmitra001 Sep 25, 2020
adca068
PyBind11: Set the correct package name in each workflow
aniketmitra001 Sep 25, 2020
3dd466b
Add python bindings to create a MoveTK point
aniketmitra001 Sep 27, 2020
16a65f5
movetk_geometry.cpp: Do not include CGLATraits header
aniketmitra001 Sep 27, 2020
2b93f65
Add python bindings for MoveTKPoint, MoveTKSegment and fix Issue #19
aniketmitra001 Oct 4, 2020
ca2d10f
Fix jupyter notebooks in tutorials/cpp as the headers have been refac…
aniketmitra001 Oct 4, 2020
0d2b1e7
Add python bindings for creating a point set and a polygon
aniketmitra001 Oct 6, 2020
afd6d3a
Add binding to find size of geometric objects
aniketmitra001 Oct 7, 2020
de284ff
Add python binding for minimum enclosing ball
aniketmitra001 Oct 8, 2020
d21cec8
Add python bindings for the geometry kernel
aniketmitra001 Oct 9, 2020
6d35da2
Change virtual environment to ubuntu-20.04
aniketmitra001 Oct 11, 2020
222f0d0
build-ubuntu.yml: Fix package name for pybind11
aniketmitra001 Oct 11, 2020
bd1a1b1
Merge branch 'master' into python-bindings
aniketmitra001 Nov 28, 2020
53b85a5
Include required headers
aniketmitra001 Nov 28, 2020
ffc3da0
Remove pybind11 as a submodule
aniketmitra001 Nov 29, 2020
5442c6b
Add pybind11 as a dependency in vcpkg response file
aniketmitra001 Nov 29, 2020
42bd641
Refactor Dockerfile to support Jupyter notebooks for tutorials on the…
aniketmitra001 Jan 26, 2021
7f2b82b
Update rapidjson submodule with latest changes
aniketmitra001 Jan 26, 2021
468fe9f
Merge changes from master
aniketmitra001 Jan 26, 2021
d0e8b27
Use std::transform instead of boost::make_transform_iterator in Dista…
aniketmitra001 Jan 26, 2021
68ff531
Update Readme
aniketmitra001 Jan 26, 2021
82fe2ae
Update README.md
aniketmitra001 Jan 26, 2021
896cd71
Update README.md
aniketmitra001 Jan 26, 2021
7ca13fa
Update README.md
aniketmitra001 Jan 26, 2021
277bc2f
Add parameter to some trajectory utilities involving computing pointw…
bacusters-tue Jan 27, 2021
60294a5
Add utility functions to downsample a trajectory
aniketmitra001 Jan 30, 2021
15b3801
Fix TrajectoryUtils.h and revert the changes in create-docker-image.yml
aniketmitra001 Jan 30, 2021
081dd53
Update README.md
aniketmitra001 Feb 8, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
13 changes: 11 additions & 2 deletions .github/workflows/build-macos.yml
Expand Up @@ -16,6 +16,15 @@ jobs:
with:
submodules: recursive
- name: install dependencies
run: brew install boost cgal gdal geographiclib gsl doxygen
run: brew install boost cgal gdal geographiclib gsl doxygen pybind11
- name: build movetk
run: GEOGRPAHICLIB_VER=$(find /usr/local/Cellar/geographiclib/ -name "lib" | awk -F"/" '{print $7}'); GEOGRPHICLIB_LDPATH=/usr/local/Cellar/geographiclib/$GEOGRPAHICLIB_VER/lib/;GDAL_VER=$(find /usr/local/Cellar/gdal/ -name "lib" | awk -F"/" '{print $7}');GDAL_LDPATH=/usr/local/Cellar/gdal/$GDAL_VER/lib/; GSL_VER=$(find /usr/local/Cellar/gsl/ -name "lib" | awk -F"/" '{print $7}');GSL_LDPATH=/usr/local/Cellar/gsl/$GSL_VER/lib/; export LIBRARY_PATH=$GEOGRPHICLIB_LDPATH:$GDAL_LDPATH:$GSL_LDPATH && echo $LIBRARY_PATH && ./ci.sh
run: |
GEOGRPAHICLIB_VER=$(find /usr/local/Cellar/geographiclib/ -name "lib" | awk -F"/" '{print $7}')
GEOGRPHICLIB_LDPATH=/usr/local/Cellar/geographiclib/$GEOGRPAHICLIB_VER/lib/
GDAL_VER=$(find /usr/local/Cellar/gdal/ -name "lib" | awk -F"/" '{print $7}')
GDAL_LDPATH=/usr/local/Cellar/gdal/$GDAL_VER/lib/
GSL_VER=$(find /usr/local/Cellar/gsl/ -name "lib" | awk -F"/" '{print $7}')
GSL_LDPATH=/usr/local/Cellar/gsl/$GSL_VER/lib/
export LIBRARY_PATH=$GEOGRPHICLIB_LDPATH:$GDAL_LDPATH:$GSL_LDPATH
echo $LIBRARY_PATH
./ci.sh
3 changes: 2 additions & 1 deletion .github/workflows/build-ubuntu.yml
Expand Up @@ -19,7 +19,8 @@ jobs:
run: |
sudo apt-get update
sudo apt-get install libboost-all-dev cmake libcgal-dev doxygen gcc g++
sudo apt-get install libgdal-dev libgsl-dev libgslcblas0 gsl-bin libgsl23 make libmpfr-dev git
sudo apt-get install libgdal-dev libgsl-dev libgslcblas0 gsl-bin libgsl23
sudo apt-get install make libmpfr-dev git pybind11-dev python3-dev
- name: install Geographiclib
run: |
wget https://sourceforge.net/projects/geographiclib/files/distrib/GeographicLib-1.50.1.zip/download
Expand Down
4 changes: 4 additions & 0 deletions .gitmodules
@@ -1,3 +1,7 @@
[submodule "third_party/rapidjson"]
path = third_party/rapidjson
url = https://github.com/Tencent/rapidjson.git
[submodule "py/pybind11"]
path = py/pybind11
url = https://github.com/pybind/pybind11.git
branch = master
3 changes: 3 additions & 0 deletions CMakeLists.txt
Expand Up @@ -52,3 +52,6 @@ add_subdirectory(tests)

# add usage example
add_subdirectory(examples)

# add python bindings
add_subdirectory(py)
7 changes: 5 additions & 2 deletions README.md
Expand Up @@ -25,6 +25,7 @@ The following table lists some of the algorithms available in MoveTK
| | Model Based Segmentation [[Alewijnse et al. 2018](https://link.springer.com/article/10.1007%2Fs00453-017-0329-x)] |
| **Trajectory Simplification** | Douglas-Peucker Simplification [[Hershberger et al. 1992,1998](https://dl.acm.org/doi/book/10.5555/902273)] |
| | Imai-Iri Simplification [[Chan et al. 1996](https://www.worldscientific.com/doi/abs/10.1142/S0218195996000058)] |
| | Agarwal Simplification [[Agarwal et al. 2005](https://doi.org/10.1007/s00453-005-1165-y)] |
| **Trajectory Similarity** | Longest Common Subsequence [[Vlachos et al. 2002](https://ieeexplore.ieee.org/document/994784)] |
| | Hausdorff & Fréchet Metric [[Eiter et al. 1994, Alt et al. 1995](https://www.worldscientific.com/doi/abs/10.1142/S0218195995000064)] |
| **Trajectory Outlier Detection** | Optimal Speed Bounded [[Custers et al. 2019](https://dl.acm.org/doi/10.1145/3347146.3359363)] |
Expand All @@ -46,7 +47,7 @@ docker run -p 6013:8888 -p 80:80 -it aniketmitra001/movetk
3. Follow instructions in the output of step 2 to open Jupyter Notebook in a web browser. Replace port number 8888 with 6013 (or another port depending on your configuration)


4. Once JupyterLab can be accessed from your browser, in-order to access the notebooks please navigate to ```/tutorials ``` using the navigation pane in JupyterLab
4. Once JupyterLab can be accessed from your browser, in-order to access the notebooks please navigate to ```/tutorials/cpp``` for the C++ notebooks and ```/tutorials/py``` for the python notebooks

**Notes** :

Expand Down Expand Up @@ -87,7 +88,8 @@ MoveTK utilizes some open source components including:
1. Modified version of GsTL (see include/third_party/GsTL-1.3)
2. TNT (Template Numerical Toolkit) (see [include/third_party/GsTL-1.3] folder)
3. Selection of headers of Boost version 1.70.0 (see [src/include/third_party/boost_future])
4. Miniball (see [src/include/third_party/miniball])
4. Miniball (see [src/include/third_party/miniball])
5. rapidjson (see include/third_party/rapidjson)

## Acknowledgements
This project includes GsTL which is software developed by Stanford University and
Expand All @@ -97,3 +99,4 @@ its contributors.
Copyright (C) 2017-2020 HERE Europe B.V.

Unless otherwise noted in `LICENSE` files for specific files or directories, the [LICENSE](LICENSE) in the root applies to all content in this repository.

140 changes: 63 additions & 77 deletions docker/with_jupyterlab/Dockerfile
@@ -1,89 +1,75 @@
FROM fedora:30
FROM continuumio/miniconda3

ARG WITH_CGAL_BACKEND=OFF

# Install dependencies
RUN dnf -y update \
&& if [ "${WITH_CGAL_BACKEND}" = "OFF" ]; then CGAL_PACKAGE=""; else CGAL_PACKAGE="CGAL-devel"; fi \
&& echo WITH_CGAL_BACKEND ${CGAL_PACKAGE} \
&& dnf -y install \
boost-devel \
cmake \
${CGAL_PACKAGE} \
doxygen \
gcc \
gcc-c++ \
gsl-devel\
gdal-devel \
GeographicLib-devel \
make \
mpfr-devel \
python3 \
python3-pip \
bzip2 \
wget \
nodejs \
net-tools \
# Configure as a web server
RUN apt-get install -q -y \
apache2 \
unzip \
&& dnf clean all \
&& rm -rf /var/cache/dnf

# Install web server
RUN dnf -y update && dnf -y install httpd && dnf -y clean all
RUN [ -d /var/log/httpd ] || mkdir /var/log/httpd
RUN [ -d /var/run/httpd ] || mkdir /var/run/httpd
RUN [ -d /var/lock/httpd ] || mkdir /var/lock/httpd
RUN sed -i.orig 's/#ServerName/ServerName/' /etc/httpd/conf/httpd.conf

ENV APACHE_RUN_USER apache
ENV APACHE_RUN_GROUP apache
ENV APACHE_LOG_DIR /var/log/httpd
ENV APACHE_LOCK_DIR /var/lock/httpd
ENV APACHE_RUN_DIR /var/run/httpd
ENV APACHE_PID_FILE /var/run/httpd/httpd.pid
&& apt-get clean

RUN /etc/init.d/apache2 start
EXPOSE 80

CMD ["/usr/sbin/httpd", "-D", "FOREGROUND"]

# These commands copy your files into the specified directory in the image
# and set that as the working location
# Install dependencies
RUN /opt/conda/bin/conda install gcc_linux-64\
gxx_impl_linux-64 \
boost \
cmake \
gsl \
make \
mpfr \
jupyterlab

RUN /opt/conda/bin/conda install -c conda-forge -y xeus-cling=0.9.0=he513fc3_0 \
gdal \
geographiclib \
awscli \
doxygen

# Build GeographicLib
WORKDIR /usr/src/

RUN wget https://downloads.sourceforge.net/project/geographiclib/distrib/GeographicLib-1.50.tar.gz
RUN tar xfpz GeographicLib-1.50.tar.gz
RUN cd /usr/src/GeographicLib-1.50
RUN mkdir /usr/src/GeographicLib-1.50/BUILD
WORKDIR /usr/src/GeographicLib-1.50/BUILD/

RUN /opt/conda/bin/cmake -DCMAKE_C_COMPILER=/opt/conda/bin/x86_64-conda_cos6-linux-gnu-gcc \
-DCMAKE_CXX_COMPILER=/opt/conda/bin/x86_64-conda_cos6-linux-gnu-g++ \
-DCMAKE_CXX_STANDARD=17 /usr/src/GeographicLib-1.50/

RUN /opt/conda/bin/make && /opt/conda/bin/make test \
&& /opt/conda/bin/make install

RUN cp /usr/local/lib/libGeographic.so* /opt/conda/lib/

# Build MoveTK
COPY . /usr/src/movetk
#COPY ./pytulib /usr/src/pytulib

# Specify the working directory
WORKDIR /usr/src/movetk

RUN mkdir -p Release \
&& cd Release \
&& cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr/local -DBUILD_DOC=ON -DWITH_CGAL_BACKEND=${WITH_CGAL_BACKEND} -DBoost_NO_BOOST_CMAKE=ON .. \
&& cmake --build . -- -j $(nproc) \
&& cmake --build . --target install

# Install miniconda to /miniconda
RUN curl -LO http://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh
RUN bash Miniconda3-latest-Linux-x86_64.sh -p /miniconda -b
RUN rm Miniconda3-latest-Linux-x86_64.sh
ENV PATH=/miniconda/bin:${PATH}
RUN conda update -y conda

# Python packages from conda
RUN conda install -c conda-forge -y \
xeus-cling=0.9.0=he513fc3_0 \
libboost \
mpfr \
libgdal \
gsl

RUN pip3 --no-cache-dir install jupyterlab
# RUN jupyter kernelspec install /miniconda/share/jupyter/kernels/xcpp11
# RUN jupyter kernelspec install /miniconda/share/jupyter/kernels/xcpp14
RUN jupyter kernelspec install /miniconda/share/jupyter/kernels/xcpp17
RUN cp /usr/src/movetk/docker/with_jupyterlab/kernel.json /usr/local/share/jupyter/kernels/xcpp17/
RUN cp /usr/src/movetk/docker/with_jupyterlab/movetk.json /miniconda/etc/xeus-cling/tags.d/
RUN cp /usr/src/movetk/docs/movetk.tag /miniconda/share/xeus-cling/tagfiles/
RUN mkdir /usr/local/include/GeographicLib
RUN cp /usr/include/GeographicLib/* /usr/local/include/GeographicLib/

RUN mkdir /usr/src/movetk/Release/
WORKDIR /usr/src/movetk/Release/

RUN /opt/conda/bin/cmake -DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=/usr/local -DBUILD_DOC=ON -DWITH_CGAL_BACKEND=OFF \
-DBoost_NO_BOOST_CMAKE=ON \
-DCMAKE_CXX_COMPILER=/opt/conda/bin/x86_64-conda_cos6-linux-gnu-g++ \
-DCMAKE_C_COMPILER=/opt/conda/bin/x86_64-conda_cos6-linux-gnu-gcc \
-DCMAKE_CXX_STANDARD=17 ..

RUN /opt/conda/bin/cmake --build . -- -j 2 \
&& /opt/conda/bin/cmake --build . --target install

# Configure Jupyter Lab
RUN jupyter kernelspec install /opt/conda/share/jupyter/kernels/xcpp17
RUN cp /usr/src/movetk/docker/with_jupyterlab/xcpp17/kernel.json /opt/conda/share/jupyter/kernels/xcpp17/

RUN cp /usr/src/movetk/docker/with_jupyterlab/movetk.json /opt/conda/etc/xeus-cling/tags.d/

RUN cp /usr/src/movetk/docs/movetk.tag /opt/conda/share/xeus-cling/tagfiles/

# Download GeoLife data
WORKDIR /usr/src/movetk/tutorials
Expand All @@ -93,6 +79,6 @@ WORKDIR /usr/src
RUN mkdir /var/www/html/movetk.reference
RUN cp -R movetk/docs/html/* /var/www/html/movetk.reference/

ENTRYPOINT httpd && jupyter lab --ip 0.0.0.0 --allow-root && /bin/bash
ENTRYPOINT jupyter lab --ip 0.0.0.0 --allow-root && /bin/bash

LABEL Name=movetk Version=0.6.0
35 changes: 0 additions & 35 deletions docker/with_jupyterlab/kernel.json

This file was deleted.

29 changes: 29 additions & 0 deletions docker/with_jupyterlab/xcpp17/kernel.json
@@ -0,0 +1,29 @@
{
"display_name": "C++17",
"argv": [
"/opt/conda/bin/xcpp",
"-std=c++17",
"-f",
"{connection_file}",
"-I",
"/usr/local/include",
"-I",
".",
"-I",
"/opt/conda/include",
"-cxx-isystem",
"/opt/conda/x86_64-conda_cos6-linux-gnu/include/c++/7.3.0",
"-cxx-isystem",
"/opt/conda/x86_64-conda_cos6-linux-gnu/include/c++/7.3.0/x86_64-conda_cos6-linux-gnu",
"-cxx-isystem",
"/opt/conda/x86_64-conda_cos6-linux-gnu/include/c++/7.3.0/backward",
"-isystem",
"/opt/conda/lib/clang/5.0.0/include",
"-extern-c-isystem",
"/opt/conda/x86_64-conda_cos6-linux-gnu/sysroot",
"-extern-c-isystem",
"/opt/conda/x86_64-conda_cos6-linux-gnu/sysroot/usr/include",
"-nostdinc++"
],
"language": "C++17"
}