forked from buckhx/QuadKey
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update setup script for publishing to PyPi.
Update docs.
- Loading branch information
Showing
7 changed files
with
74 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -40,4 +40,6 @@ nosetests.xml | |
# Virtualenv | ||
venv/ | ||
|
||
.idea | ||
.idea/ | ||
|
||
site/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,22 @@ | ||
# Installation | ||
|
||
## Requirements | ||
This library requires **Python 3.6** or higher. To compile it by yourself, Cython is required in addition. | ||
|
||
## Using Pip | ||
* `pip3 install pyquadkey2` | ||
|
||
Currently, there are pre-built `linux_x86_64` for Python 3.6, 3.7 and 3.8. If you're on a Linux system, you can simply use pip without any additional requirements. | ||
On other systems, you might need to install Cython first (`pip3 install cython`). If you encounter problems while installing, please report them as a new issue. | ||
If you encounter problems while installing, please report them as a new issue. | ||
|
||
## From archive | ||
* Download the latest [release](https://github.com/n1try/pyquadkey2/releases) as archive (`.tar.gz`) or wheel (`.whl`), e.g. `0.1.1.tar.gz` | ||
* Install it with pip: `pip3 install 0.1.1.tar.gz` | ||
|
||
## From Source | ||
* `git clone https://github.com/n1try/pyquadkey2` | ||
* `pip3 install cython` | ||
* `cd pyquadkey2/quadkey/tilesystem && python3 setup.py build_ext --inplace && ../../` | ||
* `pip3 install .` | ||
## From source | ||
* Clone repository: `git clone https://github.com/n1try/pyquadkey2` | ||
* Make sure Cython is installed: `pip3 install cython` | ||
* Compile Cython modules: `cd pyquadkey2/quadkey/tilesystem && python3 setup.py build_ext --inplace && ../../` | ||
* Install the library with Pip: `pip3 install .` | ||
|
||
## Troubleshooting | ||
* `ImportError: cannot import name 'tilesystem'`: Simply try `pip3 install --upgrade pyquadkey2` once again. Second time usually works, as required build extensions are installed then. This is a known issue and will be fixed in the future. | ||
* `ImportError: cannot import name 'tilesystem'`: Simply try `pip3 install --upgrade pyquadkey2` once again. Second time usually works, as required build extensions are installed then. This is a known issue and will be fixed in the future. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,36 @@ | ||
# Instantiation | ||
|
||
There are **three ways** of instantiating a QuadKey. | ||
|
||
## From string representation | ||
Creates a new `QuadKey` object from a tile's string representation. | ||
|
||
`from_str(qk_str: str) -> 'QuadKey'` | ||
|
||
**Example:** | ||
``` | ||
```python | ||
import quadkey | ||
qk = quadkey.from_str('010302121') # -> 010302121 | ||
``` | ||
|
||
## From integer representation | ||
Creates a new `QuadKey` object from a tile's integer representation | ||
|
||
`from_int(qk_int: int) -> 'QuadKey'` | ||
|
||
**Example:** | ||
``` | ||
```python | ||
import quadkey | ||
qk = quadkey.from_int(1379860704579813385) # -> 010302121 | ||
``` | ||
|
||
## From coordinates | ||
Creates a new `QuadKey` object from geo / GNSS coordinates | ||
|
||
`from_geo(geo: Tuple[float, float], level: int) -> 'QuadKey'` | ||
|
||
**Example:** | ||
```python | ||
import quadkey | ||
qk = quadkey.from_geo((49.011011, 8.414971), 9) # -> 120203233 | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
# Methods | ||
|
||
## children | ||
`children(self, at_level: int = -1) -> List['QuadKey']` | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,39 +1,41 @@ | ||
#!/usr/bin/env python | ||
# https://packaging.python.org/tutorials/packaging-projects/ | ||
import os | ||
# python3 setup.py sdist bdist_wheel | ||
# python3 -m twine upload --repository-url https://test.pypi.org/legacy/ dist/*.tar.gz | ||
# mkdocs build | ||
|
||
from setuptools import Extension | ||
from setuptools import setup, find_packages | ||
from setuptools.glob import glob | ||
|
||
try: | ||
from Cython.Distutils.extension import Extension | ||
from Cython.Build import build_ext | ||
except ImportError: | ||
from setuptools import Extension | ||
|
||
USING_CYTHON = False | ||
else: | ||
USING_CYTHON = True | ||
|
||
ext = 'pyx' if USING_CYTHON else 'c' | ||
sources = glob('quadkey/tilesystem/*.%s' % (ext,)) | ||
extensions = [Extension(source.split('.')[0].replace(os.path.sep, '.'), sources=[source]) for source in sources] | ||
cmdclass = {'build_ext': build_ext} if USING_CYTHON else {} | ||
with open('README.md', 'r') as fh: | ||
long_description = fh.read() | ||
|
||
setup( | ||
name='pyquadkey2', | ||
version='0.1.0', | ||
version='0.1.1', | ||
description='Python implementation of geographical tiling using QuadKeys as proposed by Microsoft', | ||
long_description=long_description, | ||
long_description_content_type='text/markdown', | ||
author='Ferdinand Mütsch', | ||
author_email='[email protected]', | ||
url='https://github.com/n1try/pyquadkey2', | ||
packages=find_packages(), | ||
classifiers=[ | ||
'Development Status :: 4 - Beta', | ||
'Programming Language :: Python :: 3', | ||
'Programming Language :: Cython', | ||
'License :: OSI Approved :: Apache Software License', | ||
'Operating System :: OS Independent', | ||
'Natural Language :: English', | ||
'Topic :: Scientific/Engineering :: GIS', | ||
'Typing :: Typed' | ||
], | ||
project_urls={ | ||
'Bug Tracker': 'https://github.com/n1try/pyquadkey2/issues', | ||
'Source Code': 'https://github.com/n1try/pyquadkey2', | ||
}, | ||
keywords='tiling quadkey quadtile geospatial geohash', | ||
python_requires='>=3.6', | ||
ext_modules=extensions, | ||
cmdclass=cmdclass | ||
ext_modules=[Extension('tilesystem', ['quadkey/tilesystem/tilesystem.c'])], | ||
ext_package='pyquadkey2' | ||
) |