Skip to main content

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 binaries are currently only available for Linux (manylinux), but Windows and Mac builds are coming up soon. 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/

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

movici-geo-query-1.1.1.tar.gz (9.4 kB view details)

Uploaded Source

Built Distributions

movici_geo_query-1.1.1-cp310-cp310-win_amd64.whl (340.4 kB view details)

Uploaded CPython 3.10 Windows x86-64

movici_geo_query-1.1.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (643.1 kB view details)

Uploaded CPython 3.10 manylinux: glibc 2.17+ x86-64

movici_geo_query-1.1.1-cp39-cp39-win_amd64.whl (340.5 kB view details)

Uploaded CPython 3.9 Windows x86-64

movici_geo_query-1.1.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (643.4 kB view details)

Uploaded CPython 3.9 manylinux: glibc 2.17+ x86-64

movici_geo_query-1.1.1-cp38-cp38-win_amd64.whl (340.2 kB view details)

Uploaded CPython 3.8 Windows x86-64

movici_geo_query-1.1.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (643.1 kB view details)

Uploaded CPython 3.8 manylinux: glibc 2.17+ x86-64

File details

Details for the file movici-geo-query-1.1.1.tar.gz.

File metadata

  • Download URL: movici-geo-query-1.1.1.tar.gz
  • Upload date:
  • Size: 9.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.13

File hashes

Hashes for movici-geo-query-1.1.1.tar.gz
Algorithm Hash digest
SHA256 6d2168ca6d45838616a9ca34ba0f8e2d0aff0f3d82776a75eddc6ab6eac3b773
MD5 3f21fb0284e7c2be98631de8db80bd9c
BLAKE2b-256 93e41d8b8fcb8dd90d6f7ceecbd8172c05a5d484c98b72284003be482f1faae3

See more details on using hashes here.

Provenance

File details

Details for the file movici_geo_query-1.1.1-cp310-cp310-win_amd64.whl.

File metadata

File hashes

Hashes for movici_geo_query-1.1.1-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 e116f4f2cbe9a23306b3b6b8846b5743910947f25eb1ae769f3f7f11c1ba90cc
MD5 3306ffae020759b5040bce73ffd582aa
BLAKE2b-256 ba09004fa1cb05161cb2bc051c0b2e1dd1c1e878bcfbade75074a7ce113d0ba5

See more details on using hashes here.

Provenance

File details

Details for the file movici_geo_query-1.1.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for movici_geo_query-1.1.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 198a0680b9ca4e3d35552f6c77421301972d42f405fb0aee30c85a6cfa3affd1
MD5 835089d4c5a07b5c32f2d392fe1c3cda
BLAKE2b-256 ec4923b0136f56d6346fed81088b8e7223647b2cb9d4a652de98f4aed7a9334a

See more details on using hashes here.

Provenance

File details

Details for the file movici_geo_query-1.1.1-cp39-cp39-win_amd64.whl.

File metadata

File hashes

Hashes for movici_geo_query-1.1.1-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 f2aa55e525fa6131b2f599cd092a1af2b82a202aa581198fd8328f99c349725e
MD5 182ae8150cbe3a0e1478ff4fce5bd07c
BLAKE2b-256 f17e3ec6836df430fd2e92e3d6e826c8877a39f7bff31bc941e48f01ad50524b

See more details on using hashes here.

Provenance

File details

Details for the file movici_geo_query-1.1.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for movici_geo_query-1.1.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 0e8d5363bc5708dd194b71485e87ed52a4d6ccd982abef38dd7982f58fb11611
MD5 fbfab756b957892b18d4b25e6c69db99
BLAKE2b-256 4529a18481a84962f2d9e76e94b4e845252df1a626fc7a449664405ab828ab89

See more details on using hashes here.

Provenance

File details

Details for the file movici_geo_query-1.1.1-cp38-cp38-win_amd64.whl.

File metadata

File hashes

Hashes for movici_geo_query-1.1.1-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 f363fc5ab6dd3a6b2ce5b42a32fcc724db4d8cb49f7ea296a940937eebd0b5e2
MD5 8d1a1ef48a729f32776436d067b4353e
BLAKE2b-256 173ed6f8cbb55fd2813956786a109a987b96cf5133e8138b8b0e10e65242c0f5

See more details on using hashes here.

Provenance

File details

Details for the file movici_geo_query-1.1.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for movici_geo_query-1.1.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 8cde07bd1b4091eb1419b4c74edd867fd90a903faf25828fba1edae772c82ca9
MD5 5a3b3a1be42e5ff12d768cdfc51bd053
BLAKE2b-256 0d13b208afc36d6ff5968c9e2f0211f5677445fe4167fba02ed828f7dc337475

See more details on using hashes here.

Provenance

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page