%global _empty_manifest_terminate_build 0 Name: python-geopip Version: 1.1 Release: 1 Summary: Reverse geocode a lng/lat coordinate within a geojson FeatureCollection. License: MIT URL: https://github.com/tammoippen/geopip Source0: https://mirrors.nju.edu.cn/pypi/web/packages/f8/68/6915c368d8ca24f1b8e91b3184241fc9a6379ff0fd39f9b949ed5a835037/geopip-1.1.tar.gz BuildArch: noarch %description |Build Status| |Coverage Status| |Tested CPython Versions| |Tested PyPy Versions| |PyPi version| |PyPi license| Reverse geocode a lng/lat coordinate within a geojson ``FeatureCollection`` and return information about the containing country (polygon). Basically, you can use any `geojson `__ file (top level is a ``FeatureCollection``) for reverse coding - set the environment variable ``REVERSE_GEOCODE_DATA`` to the geojson file. Only ``Polygon`` and ``MultiPolygon`` features will be used! If a point is found to be in a feature, the ``properties`` of that feature will be returned. In other words, provide a geojson with postcode boundaries, and you can query for the postcode in which a coordinate is. Provide timezone boundaries and you can find the timezone for a coordinate. Be creative The default shape data (contained within the package) is from `thematicmapping `__ (the simple shapes). It contains polygons representing one country with the following meta-data (``properties``): FIPS String(2) FIPS 10-4 Country Code ISO2 String(2) ISO 3166-1 Alpha-2 Country Code ISO3 String(3) ISO 3166-1 Alpha-3 Country Code UN Short Integer(3) ISO 3166-1 Numeric-3 Country Code NAME String(50) Name of country/area AREA Long Integer(7) Land area, FAO Statistics (2002) POP2005 Double(10,0) Population, World Population Prospects (2005) REGION Short Integer(3) Macro geographical (continental region), UN Statistics SUBREGION Short Integer(3) Geographical sub-region, UN Statistics LON FLOAT (7,3) Longitude LAT FLOAT (6,3) Latitude Hence, you can use this package as an *offline reverse geocoder on the country level* (by default): In [1]: import geopip In [2]: geopip.search(lng=4.910248, lat=50.850981) Out[2]: {'AREA': 0, 'FIPS': 'BE', 'ISO2': 'BE', 'ISO3': 'BEL', 'LAT': 50.643, 'LON': 4.664, 'NAME': 'Belgium', 'POP2005': 10398049, 'REGION': 150, 'SUBREGION': 155, 'UN': 56} **NOTE**: Since the polygons for each country are quite simple, reverse geocoding at the borders of two countrys is **not** exact. Use polygons with higher resolution for these use cases (see `Data <#data>`__). The ``shapely`` package will be used, if installed. Otherwise, a pure python implementation will be used (on the basis of `winding numbers `__). See `here `__, `here `__ and `here `__ for more informations and example implementations. Espacially for larger features, the shapely implementation might give performance improvements (default shape data and 2.6 GHz Intel Core i7, python3.6.2, cythonized version of `geohash-hilbert `__): *Pure*: In [1]: import geopip In [2]: geopip._geopip.p_in_polygon? Signature: geopip._geopip.p_in_polygon(p, shp) Docstring: Test, whether point `p` is in shape `shp`. Use the pure python implementation for this. Parameters: p: Tuple[float, float] Point (lng, lat) in WGS84. shp: Dict[str, Any] Prepared shape dictionary from `geopip._pure.prepare()`. Returns: boolean: True, if p in shp, False otherwise File: ~/repositories/geopip/geopip/_pure.py Type: function In [3]: %timeit geopip.search(4.910248, 50.850981) 25.6 µs ± 390 ns per loop (mean ± std. dev. of 7 runs, 10000 loops each) *Shapely*: In [1]: import geopip In [2]: geopip_geopip.p_in_polygon? Signature: geopip._geopip.p_in_polygon(p, shp) Docstring: Test, whether point `p` is in shape `shp`. Use the shapely implementation for this. Parameters: p: Tuple[float, float] Point (lng, lat) in WGS84. shp: Dict[str, Any] Prepared shape dictionary from `geopip._shapely.prepare()`. Returns: boolean: True, if p in shp, False otherwise File: ~/repositories/geopip/geopip/_shapely.py Type: function In [3]: %timeit geopip.search(4.910248, 50.850981) 50 µs ± 601 ns per loop (mean ± std. dev. of 7 runs, 10000 loops each) For simple geojsons, the pure python implementation is faster, but on more complex polygons, the shapely implementation will win. %package -n python3-geopip Summary: Reverse geocode a lng/lat coordinate within a geojson FeatureCollection. Provides: python-geopip BuildRequires: python3-devel BuildRequires: python3-setuptools BuildRequires: python3-pip %description -n python3-geopip |Build Status| |Coverage Status| |Tested CPython Versions| |Tested PyPy Versions| |PyPi version| |PyPi license| Reverse geocode a lng/lat coordinate within a geojson ``FeatureCollection`` and return information about the containing country (polygon). Basically, you can use any `geojson `__ file (top level is a ``FeatureCollection``) for reverse coding - set the environment variable ``REVERSE_GEOCODE_DATA`` to the geojson file. Only ``Polygon`` and ``MultiPolygon`` features will be used! If a point is found to be in a feature, the ``properties`` of that feature will be returned. In other words, provide a geojson with postcode boundaries, and you can query for the postcode in which a coordinate is. Provide timezone boundaries and you can find the timezone for a coordinate. Be creative The default shape data (contained within the package) is from `thematicmapping `__ (the simple shapes). It contains polygons representing one country with the following meta-data (``properties``): FIPS String(2) FIPS 10-4 Country Code ISO2 String(2) ISO 3166-1 Alpha-2 Country Code ISO3 String(3) ISO 3166-1 Alpha-3 Country Code UN Short Integer(3) ISO 3166-1 Numeric-3 Country Code NAME String(50) Name of country/area AREA Long Integer(7) Land area, FAO Statistics (2002) POP2005 Double(10,0) Population, World Population Prospects (2005) REGION Short Integer(3) Macro geographical (continental region), UN Statistics SUBREGION Short Integer(3) Geographical sub-region, UN Statistics LON FLOAT (7,3) Longitude LAT FLOAT (6,3) Latitude Hence, you can use this package as an *offline reverse geocoder on the country level* (by default): In [1]: import geopip In [2]: geopip.search(lng=4.910248, lat=50.850981) Out[2]: {'AREA': 0, 'FIPS': 'BE', 'ISO2': 'BE', 'ISO3': 'BEL', 'LAT': 50.643, 'LON': 4.664, 'NAME': 'Belgium', 'POP2005': 10398049, 'REGION': 150, 'SUBREGION': 155, 'UN': 56} **NOTE**: Since the polygons for each country are quite simple, reverse geocoding at the borders of two countrys is **not** exact. Use polygons with higher resolution for these use cases (see `Data <#data>`__). The ``shapely`` package will be used, if installed. Otherwise, a pure python implementation will be used (on the basis of `winding numbers `__). See `here `__, `here `__ and `here `__ for more informations and example implementations. Espacially for larger features, the shapely implementation might give performance improvements (default shape data and 2.6 GHz Intel Core i7, python3.6.2, cythonized version of `geohash-hilbert `__): *Pure*: In [1]: import geopip In [2]: geopip._geopip.p_in_polygon? Signature: geopip._geopip.p_in_polygon(p, shp) Docstring: Test, whether point `p` is in shape `shp`. Use the pure python implementation for this. Parameters: p: Tuple[float, float] Point (lng, lat) in WGS84. shp: Dict[str, Any] Prepared shape dictionary from `geopip._pure.prepare()`. Returns: boolean: True, if p in shp, False otherwise File: ~/repositories/geopip/geopip/_pure.py Type: function In [3]: %timeit geopip.search(4.910248, 50.850981) 25.6 µs ± 390 ns per loop (mean ± std. dev. of 7 runs, 10000 loops each) *Shapely*: In [1]: import geopip In [2]: geopip_geopip.p_in_polygon? Signature: geopip._geopip.p_in_polygon(p, shp) Docstring: Test, whether point `p` is in shape `shp`. Use the shapely implementation for this. Parameters: p: Tuple[float, float] Point (lng, lat) in WGS84. shp: Dict[str, Any] Prepared shape dictionary from `geopip._shapely.prepare()`. Returns: boolean: True, if p in shp, False otherwise File: ~/repositories/geopip/geopip/_shapely.py Type: function In [3]: %timeit geopip.search(4.910248, 50.850981) 50 µs ± 601 ns per loop (mean ± std. dev. of 7 runs, 10000 loops each) For simple geojsons, the pure python implementation is faster, but on more complex polygons, the shapely implementation will win. %package help Summary: Development documents and examples for geopip Provides: python3-geopip-doc %description help |Build Status| |Coverage Status| |Tested CPython Versions| |Tested PyPy Versions| |PyPi version| |PyPi license| Reverse geocode a lng/lat coordinate within a geojson ``FeatureCollection`` and return information about the containing country (polygon). Basically, you can use any `geojson `__ file (top level is a ``FeatureCollection``) for reverse coding - set the environment variable ``REVERSE_GEOCODE_DATA`` to the geojson file. Only ``Polygon`` and ``MultiPolygon`` features will be used! If a point is found to be in a feature, the ``properties`` of that feature will be returned. In other words, provide a geojson with postcode boundaries, and you can query for the postcode in which a coordinate is. Provide timezone boundaries and you can find the timezone for a coordinate. Be creative The default shape data (contained within the package) is from `thematicmapping `__ (the simple shapes). It contains polygons representing one country with the following meta-data (``properties``): FIPS String(2) FIPS 10-4 Country Code ISO2 String(2) ISO 3166-1 Alpha-2 Country Code ISO3 String(3) ISO 3166-1 Alpha-3 Country Code UN Short Integer(3) ISO 3166-1 Numeric-3 Country Code NAME String(50) Name of country/area AREA Long Integer(7) Land area, FAO Statistics (2002) POP2005 Double(10,0) Population, World Population Prospects (2005) REGION Short Integer(3) Macro geographical (continental region), UN Statistics SUBREGION Short Integer(3) Geographical sub-region, UN Statistics LON FLOAT (7,3) Longitude LAT FLOAT (6,3) Latitude Hence, you can use this package as an *offline reverse geocoder on the country level* (by default): In [1]: import geopip In [2]: geopip.search(lng=4.910248, lat=50.850981) Out[2]: {'AREA': 0, 'FIPS': 'BE', 'ISO2': 'BE', 'ISO3': 'BEL', 'LAT': 50.643, 'LON': 4.664, 'NAME': 'Belgium', 'POP2005': 10398049, 'REGION': 150, 'SUBREGION': 155, 'UN': 56} **NOTE**: Since the polygons for each country are quite simple, reverse geocoding at the borders of two countrys is **not** exact. Use polygons with higher resolution for these use cases (see `Data <#data>`__). The ``shapely`` package will be used, if installed. Otherwise, a pure python implementation will be used (on the basis of `winding numbers `__). See `here `__, `here `__ and `here `__ for more informations and example implementations. Espacially for larger features, the shapely implementation might give performance improvements (default shape data and 2.6 GHz Intel Core i7, python3.6.2, cythonized version of `geohash-hilbert `__): *Pure*: In [1]: import geopip In [2]: geopip._geopip.p_in_polygon? Signature: geopip._geopip.p_in_polygon(p, shp) Docstring: Test, whether point `p` is in shape `shp`. Use the pure python implementation for this. Parameters: p: Tuple[float, float] Point (lng, lat) in WGS84. shp: Dict[str, Any] Prepared shape dictionary from `geopip._pure.prepare()`. Returns: boolean: True, if p in shp, False otherwise File: ~/repositories/geopip/geopip/_pure.py Type: function In [3]: %timeit geopip.search(4.910248, 50.850981) 25.6 µs ± 390 ns per loop (mean ± std. dev. of 7 runs, 10000 loops each) *Shapely*: In [1]: import geopip In [2]: geopip_geopip.p_in_polygon? Signature: geopip._geopip.p_in_polygon(p, shp) Docstring: Test, whether point `p` is in shape `shp`. Use the shapely implementation for this. Parameters: p: Tuple[float, float] Point (lng, lat) in WGS84. shp: Dict[str, Any] Prepared shape dictionary from `geopip._shapely.prepare()`. Returns: boolean: True, if p in shp, False otherwise File: ~/repositories/geopip/geopip/_shapely.py Type: function In [3]: %timeit geopip.search(4.910248, 50.850981) 50 µs ± 601 ns per loop (mean ± std. dev. of 7 runs, 10000 loops each) For simple geojsons, the pure python implementation is faster, but on more complex polygons, the shapely implementation will win. %prep %autosetup -n geopip-1.1 %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-geopip -f filelist.lst %dir %{python3_sitelib}/* %files help -f doclist.lst %{_docdir}/* %changelog * Fri May 05 2023 Python_Bot - 1.1-1 - Package Spec generated