diff options
-rw-r--r-- | .gitignore | 1 | ||||
-rw-r--r-- | python-visvalingamwyatt.spec | 287 | ||||
-rw-r--r-- | sources | 1 |
3 files changed, 289 insertions, 0 deletions
@@ -0,0 +1 @@ +/visvalingamwyatt-0.2.0.tar.gz diff --git a/python-visvalingamwyatt.spec b/python-visvalingamwyatt.spec new file mode 100644 index 0000000..5f31bda --- /dev/null +++ b/python-visvalingamwyatt.spec @@ -0,0 +1,287 @@ +%global _empty_manifest_terminate_build 0 +Name: python-visvalingamwyatt +Version: 0.2.0 +Release: 1 +Summary: Simplify geometries with the Visvalingam-Wyatt algorithm +License: MIT +URL: https://github.com/fitnr/visvalingamwyatt +Source0: https://mirrors.nju.edu.cn/pypi/web/packages/6f/f3/feea4fc41bbe6113e6de5836cf255266ce22937bf95445f72d862dda2968/visvalingamwyatt-0.2.0.tar.gz +BuildArch: noarch + +Requires: python3-numpy +Requires: python3-coverage + +%description +# Visvalingam-Wyatt + +A Python implementation of the Visvalingam-Wyatt line simplification algorithm. + +This implementation is due to [Eliot Hallmark](https://github.com/Permafacture/Py-Visvalingam-Whyatt/). This release simply packages it as a Python module. + +## Use + +```python +>>> import visvalingamwyatt as vw +>>> points = [(1, 2), (2, 3), (3, 4), ...] +>>> vw.simplify(points) +[(1, 2), (3, 4), ...] +``` + +Points may be any `Sequence`-like object that (`list`, `tuple`, a custom class that exposes an `__iter__` method). + +Test different methods and thresholds: +```python +simplifier = vw.Simplifier(points) + +# Simplify by percentage of points to keep +simplifier.simplify(ratio=0.5) + +# Simplify by giving number of points to keep +simplifier.simplify(number=1000) + +# Simplify by giving an area threshold (in the units of the data) +simplifier.simplify(threshold=0.01) +``` + +Shorthands for working with geodata: + +````python +import visvalingamwyatt as vw + +feature = { + "properties": {"foo": "bar"}, + "geometry": { + "type": "Polygon", + "coordinates": [...] + } +} + +# returns a copy of the geometry, simplified (keeping 90% of points) +vw.simplify_geometry(feature['geometry'], ratio=0.90) + +# returns a copy of the feature, simplified (using an area threshold) +vw.simplify_feature(feature, threshold=0.90) +```` + +The command line tool `vwsimplify` is available to simplify GeoJSON files: + +```` +# Simplify using a ratio of points +vwsimplify --ratio 0.90 in.geojson -o simple.geojson + +# Simplify using the number of points to keep +vwsimplify --number 1000 in.geojson -o simple.geojson + +# Simplify using a minimum area +vwsimplify --threshold 0.001 in.geojson -o simple.geojson +```` + +Install [Fiona](https://github.com/Toblerity/Fiona) for the additional ability to simplify any geodata layer. + +## License + +MIT + + + + +%package -n python3-visvalingamwyatt +Summary: Simplify geometries with the Visvalingam-Wyatt algorithm +Provides: python-visvalingamwyatt +BuildRequires: python3-devel +BuildRequires: python3-setuptools +BuildRequires: python3-pip +%description -n python3-visvalingamwyatt +# Visvalingam-Wyatt + +A Python implementation of the Visvalingam-Wyatt line simplification algorithm. + +This implementation is due to [Eliot Hallmark](https://github.com/Permafacture/Py-Visvalingam-Whyatt/). This release simply packages it as a Python module. + +## Use + +```python +>>> import visvalingamwyatt as vw +>>> points = [(1, 2), (2, 3), (3, 4), ...] +>>> vw.simplify(points) +[(1, 2), (3, 4), ...] +``` + +Points may be any `Sequence`-like object that (`list`, `tuple`, a custom class that exposes an `__iter__` method). + +Test different methods and thresholds: +```python +simplifier = vw.Simplifier(points) + +# Simplify by percentage of points to keep +simplifier.simplify(ratio=0.5) + +# Simplify by giving number of points to keep +simplifier.simplify(number=1000) + +# Simplify by giving an area threshold (in the units of the data) +simplifier.simplify(threshold=0.01) +``` + +Shorthands for working with geodata: + +````python +import visvalingamwyatt as vw + +feature = { + "properties": {"foo": "bar"}, + "geometry": { + "type": "Polygon", + "coordinates": [...] + } +} + +# returns a copy of the geometry, simplified (keeping 90% of points) +vw.simplify_geometry(feature['geometry'], ratio=0.90) + +# returns a copy of the feature, simplified (using an area threshold) +vw.simplify_feature(feature, threshold=0.90) +```` + +The command line tool `vwsimplify` is available to simplify GeoJSON files: + +```` +# Simplify using a ratio of points +vwsimplify --ratio 0.90 in.geojson -o simple.geojson + +# Simplify using the number of points to keep +vwsimplify --number 1000 in.geojson -o simple.geojson + +# Simplify using a minimum area +vwsimplify --threshold 0.001 in.geojson -o simple.geojson +```` + +Install [Fiona](https://github.com/Toblerity/Fiona) for the additional ability to simplify any geodata layer. + +## License + +MIT + + + + +%package help +Summary: Development documents and examples for visvalingamwyatt +Provides: python3-visvalingamwyatt-doc +%description help +# Visvalingam-Wyatt + +A Python implementation of the Visvalingam-Wyatt line simplification algorithm. + +This implementation is due to [Eliot Hallmark](https://github.com/Permafacture/Py-Visvalingam-Whyatt/). This release simply packages it as a Python module. + +## Use + +```python +>>> import visvalingamwyatt as vw +>>> points = [(1, 2), (2, 3), (3, 4), ...] +>>> vw.simplify(points) +[(1, 2), (3, 4), ...] +``` + +Points may be any `Sequence`-like object that (`list`, `tuple`, a custom class that exposes an `__iter__` method). + +Test different methods and thresholds: +```python +simplifier = vw.Simplifier(points) + +# Simplify by percentage of points to keep +simplifier.simplify(ratio=0.5) + +# Simplify by giving number of points to keep +simplifier.simplify(number=1000) + +# Simplify by giving an area threshold (in the units of the data) +simplifier.simplify(threshold=0.01) +``` + +Shorthands for working with geodata: + +````python +import visvalingamwyatt as vw + +feature = { + "properties": {"foo": "bar"}, + "geometry": { + "type": "Polygon", + "coordinates": [...] + } +} + +# returns a copy of the geometry, simplified (keeping 90% of points) +vw.simplify_geometry(feature['geometry'], ratio=0.90) + +# returns a copy of the feature, simplified (using an area threshold) +vw.simplify_feature(feature, threshold=0.90) +```` + +The command line tool `vwsimplify` is available to simplify GeoJSON files: + +```` +# Simplify using a ratio of points +vwsimplify --ratio 0.90 in.geojson -o simple.geojson + +# Simplify using the number of points to keep +vwsimplify --number 1000 in.geojson -o simple.geojson + +# Simplify using a minimum area +vwsimplify --threshold 0.001 in.geojson -o simple.geojson +```` + +Install [Fiona](https://github.com/Toblerity/Fiona) for the additional ability to simplify any geodata layer. + +## License + +MIT + + + + +%prep +%autosetup -n visvalingamwyatt-0.2.0 + +%build +%py3_build + +%install +%py3_install +install -d -m755 %{buildroot}/%{_pkgdocdir} +if [ -d doc ]; then cp -arf doc %{buildroot}/%{_pkgdocdir}; fi +if [ -d docs ]; then cp -arf docs %{buildroot}/%{_pkgdocdir}; fi +if [ -d example ]; then cp -arf example %{buildroot}/%{_pkgdocdir}; fi +if [ -d examples ]; then cp -arf examples %{buildroot}/%{_pkgdocdir}; fi +pushd %{buildroot} +if [ -d usr/lib ]; then + find usr/lib -type f -printf "/%h/%f\n" >> filelist.lst +fi +if [ -d usr/lib64 ]; then + find usr/lib64 -type f -printf "/%h/%f\n" >> filelist.lst +fi +if [ -d usr/bin ]; then + find usr/bin -type f -printf "/%h/%f\n" >> filelist.lst +fi +if [ -d usr/sbin ]; then + find usr/sbin -type f -printf "/%h/%f\n" >> filelist.lst +fi +touch doclist.lst +if [ -d usr/share/man ]; then + find usr/share/man -type f -printf "/%h/%f.gz\n" >> doclist.lst +fi +popd +mv %{buildroot}/filelist.lst . +mv %{buildroot}/doclist.lst . + +%files -n python3-visvalingamwyatt -f filelist.lst +%dir %{python3_sitelib}/* + +%files help -f doclist.lst +%{_docdir}/* + +%changelog +* Wed May 10 2023 Python_Bot <Python_Bot@openeuler.org> - 0.2.0-1 +- Package Spec generated @@ -0,0 +1 @@ +915225da88eab7936c5be736f8fda376 visvalingamwyatt-0.2.0.tar.gz |