Skip to main content

Very user friendly library to parse OpenSourceMap data either from an XML file (i.e. *.osm), from an OSM API URL, or from a user specified bounding box

Project description

GeoScraper

GitHub version PyPI version

Very user friendly library to parse OpenSourceMap data either from an XML file (i.e. *.osm), from an OSM API URL, or from a user specified bounding box.

To Install

pip install GeoScraper

Example Python Script

import os
from pprint import pprint

from GeoScraper import GeoScraper


USE_BBOX  = True
USE_FILE  = True
USE_URL   = True

XML_FNAME = os.path.join(os.path.dirname(__file__), 'map.osm') # YOU MAY NEED TO CHANGE THIS LINE!
BBOX = [-84.0958000, # left
         39.7617000, # bottom
        -84.0484000, # right
         39.7823000] # top
URL = r'https://api.openstreetmap.org/api/0.6/map?bbox=-84.0958000,39.7617000,-84.0484000,39.7823000'


if __name__ == '__main__':
    scraper = GeoScraper()
    
    if USE_FILE:
        print('=' * 50)
        print('Using file:')
        print('=' * 50)
        scraper.from_file(XML_FNAME)
        pprint(scraper.highways()[:3])
        print('\n')
    
    if USE_BBOX:
        print('=' * 50)
        print('Using bbox:')
        print('=' * 50)
        scraper.from_bbox(left   = BBOX[0],
                          bottom = BBOX[1],
                          right  = BBOX[2],
                          top    = BBOX[3])
        pprint(scraper.highways()[:3])
        print('\n')
        print('=' * 50)
        print('Done')
        print('=' * 50)
    
    if USE_URL:
        print('=' * 50)
        print('Using url:')
        print('=' * 50)
        scraper.from_url(URL)
        pprint(scraper.highways()[:3])
        print('\n')
        print('=' * 50)
        print('Done')
        print('=' * 50)

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

GeoScraper-0.0.1.tar.gz (6.0 kB view hashes)

Uploaded Source

Built Distribution

GeoScraper-0.0.1-py3-none-any.whl (6.2 kB view hashes)

Uploaded Python 3

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