Geospatial queries powered by Boost Geom
Project description
Movici Geo Query is a library for creating geospatial indexes (rtrees) and querying those trees. It is targeted and optimized to work together with other Movici libaries. It works natively with numpy arrays, where multi-point geometries (such as linestrings and polygons) are accepted using Movici’s csr format.
Getting Started
import numpy as np
from movici_geo_query import GeoQuery, PointGeometry
points_a = PointGeometry(np.array([[0, 1], [0.5, 1]]))
points_b = PointGeometry(np.array([[0.6, 0.9]]))
gq = GeoQuery(points_a)
result = gq.nearest_to(points_b)
# for each point in point_b, gq.nearest returns the index of the nearest point in points_a. The
# result will have the same length as points_b and contains indexes to the points_a array
print(result.indices) # np.array([1])
Installation
Movici Geo Query binary wheels are currently available for Linux (manylinux) and Windows. There are currently no concrete plans for Mac builds. If you’d like to have macos binaries, please create an issue for it. Installation can be done using pip install movici-geo-query
Building from source
Building from source requires a C compiler that supports C++17, such as Clang>=5. To build movici-geo-query from source you also need a version of Boost.geometry that contains the boost::geometry::index::rtree headers (eg. boost > 1.74.0). These can be installed using your favorite package manager, downloaded from the Boost website, or taken directly from GitHub. When downloading manually, make sure the boost header files can be found by pip by placing them in pythons include directory:
BOOST_VERSION=1.79.0
INCLUDE_DIR=$(python3 -c "import sysconfig as sc; print(sc.get_paths()['include'])")
TMP_DIR=/tmp/boost_geometry
mkdir -p ${TMP_DIR}
git clone --depth 1 --branch boost-${BOOST_VERSION} https://github.com/boostorg/geometry.git ${TMP_DIR}
cp ${TMP_DIR}/include/boost ${INCLUDE_DIR}
Now you can clone, compile and install from source:
git clone https://github.com/nginfra/movici-geo-query.git
pip3 install movici-geo-query/
To specify a compiler, use the CC environment variable:
CC=g++7 pip install movici-geo-query/
Developing Movici Geo Query
Developing Movici Geo Query assumes you’re developing on Linux using a modern C++ compiler that support C++17, such as Clang>=5. We have tests both in C++ and in Python. Supported Python versions are 3.8 and higher. It also requires Boost.geometry (see Building from source)
# install the dev requirements
pip3 install -r requirements-dev.txt
# install the package in editable mode
pip3 install -e -v .
# run the c test suite
mkdir build
cd build
cmake ..
make -j
./test
cd ..
# run the python test suite
pytest tests/python
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
File details
Details for the file movici-geo-query-1.2.0.tar.gz
.
File metadata
- Download URL: movici-geo-query-1.2.0.tar.gz
- Upload date:
- Size: 9.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.9.15
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 629f4d1154c568ac383cfd5c9ac2a6364e9157e336efb1b638ba5938a4d64981 |
|
MD5 | 352cdefe415b2b4f1018ebbc2c69ec11 |
|
BLAKE2b-256 | 2f4964a08e955350ce29afa42cc9b092ff9e150e88cc14271c766af12af67903 |
File details
Details for the file movici_geo_query-1.2.0-cp311-cp311-win_amd64.whl
.
File metadata
- Download URL: movici_geo_query-1.2.0-cp311-cp311-win_amd64.whl
- Upload date:
- Size: 350.3 kB
- Tags: CPython 3.11, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.9.15
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a79770f0b1e294d7c4c8f05a4159b2d95dc71629379dd451bbb67be1550c514f |
|
MD5 | 58c66664096af1f429e26a4d94dd5422 |
|
BLAKE2b-256 | a22b7bb1d7db78ce7c3d7a083b8d97ad2f8758089c20666d1aff7d4d9375c2b6 |
File details
Details for the file movici_geo_query-1.2.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
.
File metadata
- Download URL: movici_geo_query-1.2.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 665.2 kB
- Tags: CPython 3.11, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.9.15
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 20b9648d94200e3a9d1c99e8681c17aa287f69711e4c12653b0320b9868d2cee |
|
MD5 | 7fa49ad58c8e75abf3bb763aa814b0ff |
|
BLAKE2b-256 | 56b8339ea678b1867d07c18eb5cc06e04324fe01f769f242271e0460ae159bdf |
File details
Details for the file movici_geo_query-1.2.0-cp310-cp310-win_amd64.whl
.
File metadata
- Download URL: movici_geo_query-1.2.0-cp310-cp310-win_amd64.whl
- Upload date:
- Size: 350.3 kB
- Tags: CPython 3.10, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.9.15
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 03043ebceae1707068f9f505484a26d2c200dc9c313f636ed841dc909ac63e17 |
|
MD5 | 312c6b3da9b712b4be9ceca2e4ce658a |
|
BLAKE2b-256 | a62bff6915e95dc8fc3bcc829f125eb5a27f6ead6cc053a893e5ccd836eca0f1 |
File details
Details for the file movici_geo_query-1.2.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
.
File metadata
- Download URL: movici_geo_query-1.2.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 665.1 kB
- Tags: CPython 3.10, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.9.15
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | b5beac20b51de49bb7c7dbc9dc9c1866bec83814d3bf2b447869d4b785b62368 |
|
MD5 | 07cc95cbef0877329d7982b3299683c6 |
|
BLAKE2b-256 | 1cfa8a3a1d44ae8db73d5ab361d7f82bf52f60e419a05ab3c1bdef43f1b52c64 |
File details
Details for the file movici_geo_query-1.2.0-cp39-cp39-win_amd64.whl
.
File metadata
- Download URL: movici_geo_query-1.2.0-cp39-cp39-win_amd64.whl
- Upload date:
- Size: 350.4 kB
- Tags: CPython 3.9, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.9.15
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d76173bfb7a6da3833a8056c7a2ee35c7e51c2ea60e36525557e99d90480d988 |
|
MD5 | d5604f7faec8cecefb3b966a543ad6ca |
|
BLAKE2b-256 | efa94e8b08511b9c6158089fea7173b9a084afe06583b298a83683cee0e2d121 |
File details
Details for the file movici_geo_query-1.2.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
.
File metadata
- Download URL: movici_geo_query-1.2.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 664.5 kB
- Tags: CPython 3.9, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.9.15
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2bbf965f09f8f86ce9ee9f55fb322389dae9714572395611816b0413e8c7db66 |
|
MD5 | fd6ebd346c4b0708db3c3158d0716f77 |
|
BLAKE2b-256 | 9ec421602added49a7d2446b68e54f124abceea5e75941bf018f1ffac7f20dd3 |
File details
Details for the file movici_geo_query-1.2.0-cp38-cp38-win_amd64.whl
.
File metadata
- Download URL: movici_geo_query-1.2.0-cp38-cp38-win_amd64.whl
- Upload date:
- Size: 350.2 kB
- Tags: CPython 3.8, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.9.15
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8ae28c11017b1d289283078a290e8e5639bcd957e6cd5852eb64a846c8b0a76f |
|
MD5 | abb03596664a2364ad5a4cdbef7aca5e |
|
BLAKE2b-256 | a1fd6de3c4905cc66e2559af3e22397330d8b382ad3cb730c7f326ab6b1562c8 |
File details
Details for the file movici_geo_query-1.2.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
.
File metadata
- Download URL: movici_geo_query-1.2.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 663.8 kB
- Tags: CPython 3.8, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.9.15
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ee5b4868eaf08e0f97e4144ffb4efffcb5fdc0e72f0d282a0330aeb7e063e1b6 |
|
MD5 | fc041785071634893d1b8a1711ee71ca |
|
BLAKE2b-256 | f197dc1579c8827d43a9139cb831dc372fdb1df7dfb57bc8d75e6d81bc9c8cde |