Today i released a small package called geoiter. Used for web scraping
# geoiter

iterates the planet.

**edit**

A simple tool to iterate coordinates within given boundaries.  
The usage is mostly for querying/searching by location.   
Geoiter provides many locations within a boundary, like a country.   
Let's say Germany has in sum 5000 houses to sell. Then most platforms will only allow you to visit the first 200 houses.   
Now to get the others, you need to dissect the big boundary area into smaller ones.  
And this is where geoiter provides you with coordinates

you can find the source on

[https://github.com/cloasdata/geoiter](https://github.com/cloasdata/geoiter)

**/ edit**

&amp;#x200B;

https://preview.redd.it/vlzva9z6rzo81.png?width=665&amp;format=png&amp;auto=webp&amp;s=72c8ebf635d7ae8ec3bfcbf1f74217fd53065daf

**geoiter** can be used for web scraping to utilize geo/location queries:

&amp;#x200B;

&amp;#x200B;

https://preview.redd.it/kdypecx8rzo81.png?width=1590&amp;format=png&amp;auto=webp&amp;s=930cb8c7837bb1b1d9a80718b12538c713f229b0

In many cases the web page restrict the result items to a fixed number. With geoiter you can now dissect this one query to a many location queries to relax the result density under the restriction limit.

geoiter has only one additional dependency called [haversine](https://pypi.org/project/haversine/).

## install

    pip install geoiter

## usage

    import pickle
    
    from geoiter.util.ressource_example import germany
    from geoiter import GeoIter
    
    # get you boundary for example
    with open(germany, "rb") as file:
        germany = pickle.load(file)
    
    # prepare
    gi = GeoIter(
        boundary=germany,
        radius=100,
        comp_rate=20
        )
    
    if __name__ == "__main__":
        # plot them as example
        for coordinate in gi:
            print(coordinate)

## speed

one may consider that geo data have mb of coordinates. Which may make the this iteration very slow, because it needs to look up coordinates in the boundary often. To accelerate the **geoiter** provides a very simple compressor and uses bisect instead of list iteration. However, it still can be slow.

## extensions

There two extensions which give additional help

    pip install geoiter["gpx]

provides you with an gpx exporter.

    pip install geoiter["plot"]

provides a plotting function to visualize the grid.

## data

get boundaries from osm or others sources like

* [https://www.geoboundaries.org/](https://www.geoboundaries.org/)
* [https://osm-boundaries.com/](https://osm-boundaries.com/)
* ...