SlideShare a Scribd company logo
1 of 35
PRESENTATION
ON
GEOPY PYTHON MODULE
PRESENT BY:
Sayam Baidar(02)
Sijan Bhandari(04)
Rabina Twayana(29)
Date:13 Feb 2020
1
CONTENTS
 Python Module
 Introduction to GeoPy
 Installation of GeoPy
 Geocoding Vs Reverse Geocoding
 Commonly Used method in GeoPy
 Uses of GeoPy in Distance Calculation
 Accessing data in GeoPy
 Exception in GeoPy
2
Python Module
 A module is a file consisting of Python code.
 A module can define functions, classes and variables.
 A module can also include runnable code.
 A module is a file containing Python definitions and statements
3
Introduction to GeoPy
 Geopy is a python module that includes geocoders class for calling several geocoding
web services such as:
• Open StreetMap Nominatim
• ESRI ArcGIS
• Google Geocoding API(V3)
• Bing Maps API
• Yandex
• OpenMapQuest
• NaviData
• GeoNames
• DeocodeFare etc
4
Contd….
 Makes easy to locate :
• Co-ordinate
• Address
• Geographic location(Mountains, rivers etc)
• Landmarks
• Cities
• Countries across the globe using geocoders and other data sources
5
Installation using pip
 pip is install by default if we are using python 2>=2.7.9 or python 3>=3.4
 If not, then install pip or install latest python for windows which support pip from
https://www.python.org/
6
To check installed pip version
7
geopy installation
 In command prompt run:
pip install geopy
8
Geocoder
 A class for handling Geocoding and Reverse Geocoding
 Geocoders define at least a geocode() method and a reverse() method.
 Each geolocation service we might use, such as Google Maps, Bing Maps, or
Nominatim etc, has its own class in geopy.geocoders
 Geocoder accepts any settings needed to interact with its service, e.g., an API key,
during its initialization.
 An API key is a unique identifier used to authenticate a user, or developer to an API
which allow communication with services.
from geopy.geocoders import Nominatim
geolocator=Nominatim(user_agent=“specify_your_app_name_here”)
9
Geocoding Vs Reverse Geocoding
Geocoding(Forward Geocoding) Reverse Geocoding
The process of converting addresses (like a
street address) into geographic coordinates
(like latitude and longitude),
The process of converting geographic
coordinates into a human-readable address.
Used to place markers on a map, or position
the map.
Used to find the address corresponding to a set
of coordinates:
Uses geocode() method Uses reverse() method
10
Commonly used methods in geopy
 geocode()
Syntax: geocode(query)
where, query(str) is address we wish to geocode
 reverse()
Syntax: reverse(query)
where query is coordinates(lat,long) for which we wish to obtain human-readable
addresses.
Both method returns geopy.location.Location object
11
geocode() method
 Resolves given address into pair of coordinates
Output:
Kathmandu University, KU road, Kuttal, Srikhandapur, Dhulikhel, काभ्रेपलाञ्चोक, Bagmati
Pradesh, 09771, Nepal
(27.61866315, 85.53822627738802)
12
How to get an API key for OpenMapQuest?
 Signed-up first from https://developer.mapquest.com
 Click on "Create a New Key"
 Filled in "App Name"
 Filled in "Callback URL“
 Click on “Create app”
 Click on uparrow of app name
 Get API key for OpenMapQuest
13
Geocoding using API key
 Output:
27.6474649
85.3348047874904
 Output using Nominatim:
(27.61866315, 85.53822627738802)
14
reverse() method
 Resolve pair of co-ordinates to an address.
 Output
Kathmandu University, KU road, Kuttal, Srikhandapur, Dhulikhel, काभ्रेपलाञ्चोक, Bagmati
Pradesh, 09771, Nepal
(27.61866315, 85.53822627738802)
15
Distance Calculation
 GeoPy can calculate distance between two points.
 Mainly two types of distance are calculated by GeoPy:
• Great Circle Distance
• Geodesic Distance
16
Great Circle Distance
 Great circle distance is the shortest distance between two points on the surface of a
sphere
 Uses spherical model of the Earth to calculate the surface distance between two points.
 Syntax:
great_circle (args1, args2)
where args1=location1 co-ordinate value
args2= location2 co-ordinate value
17
 Output:
388.4096417472016 km
241.3465621689344
388409.6417472016
18
Geodesic Distance
 A geodesic is the shortest path between two points on a curved surface, analogous to a
straight line on a plane surface
 Uses ellipsoidal model of the Earth to calculate shortest distance between two point on
the surface of Earth.
 More accurate than great_circle distance
 default is WGS-84 ellipsoid which is most globally accurate
 Includes few other models in the distance.ELLIPSOIDS dictionary:
• GRS-80
• GRS-67
• Airy (1830)
• Intl 1924
• Clarke (1880)
19
 Syntax
geodesic(args1, args2)
 Output
386.2061376343612 km
386.20613763557986 km
20
Data
 Class geopy.location.Location
 Access the properties
• address: return type- Unicode
Location as a formatted string returned by the geocoder, depending on the service
• latitude: return type- float
Location’s latitude
• longitude: return type –float
Location’s longitude
• altitude :return type- float
Location’s altitude.
• raw: return type-dict
Location’s raw, unparsed geocoder response.
21
22
Contd..
 Class geopy.point.Point
 A geodetic point with latitude, longitude, and altitude.
 Latitude and longitude are floating point values in degrees, minutes, seconds. Altitude
is a floating point value in kilometers.
 Points can be created in a number of ways…..
23
 Output
41 30m 0s S, 81 0m 0s W
41 30m 0s S, 81 0m 0s W
41 30m 0s S, 81 0m 0s W, 2.5km
23 26m 22s N, 23 27m 30s E, 33.796224km
3 26m 22s N, 23 27m 30s E
24
GeopyError
Exception
BaseException
ConfigurationError GeocoderServiceError GeocoderNotFound
Exception class Hierarchy in GeoPy
25
Exception
 In Python, all exceptions must be instances of a class that derives from BaseException,
then Exception and the GeopyError
 Geopy-specific exceptions are all inherited from GeopyError.
 Three Exception class are inherited from GeopyError Class. They are
• ConfigurationError
When instantiating a geocoder, the arguments given were invalid.
• GeocoderNotFound
Caller requested the geocoder matching a string, e.g., "google" > GoogleV3, but no
geocoder could be found.
26
Contd
• GeocoderServiceError
 There was an exception caused when calling the remote geocoding service, and no more specific
exception could be raised by geopy.
 When calling geocoders’ geocode or reverse methods, this is the most generic exception that can
be raised, and any non-geopy exception will be caught and turned into this.
27
GeocoderServiceError
GeocoderInsufficientPrivileges
GeocoderAuthenticationFailure
GeocoderUnavailable GeocoderTimedOut
GeocoderParseError
GeocoderQueryError
28
EXCEPTION DESCRIPTION
GeocoderQueryError Either geopy detected input that would cause a request to fail, or a request was made and the
remote geocoding service responded that the request was bad
GeocoderUnavailable when it was not possible to establish a connection to the remote geocoding service
GeocoderParseError Geopy could not parse the service’s response. This is probably due to a bug in geopy.
GeocoderInsufficientPrivileges The remote geocoding service refused to fulfill a request using the account credentials given.
GeocoderAuthenticationFailure The remote geocoding service rejected the API key, geocoder instantiated with.
GeocoderTimedOut The call to the geocoding service was aborted because no response has been received within the
timeout argument .Some services are just consistently slow, and a higher timeout may be needed to
use them.
29
30
 Output:
27.61866315 85.53822627738802
OR
Error
Service timed out
GeocoderQueryError
31
ConfigurationError
32
REFRENCES
 GeoPy’s documentation. (2017, February 2). Retrieved January 13, 2020, from GeoPy
Stable: https://geopy.readthedocs.io/en/stable/
 Python, 3.8.1. (2019, December 18). Retrieved January 7, 2020, from
https://www.python.org/downloads/
 Reddy., G. C. (2019, September 1). Python Modules. Retrieved January 11, 2020, from
Python Tutorials for Beginners: http://www.gcreddy.com/python/python-modules/
THANK YOU FOR YOUR
ATTENTATION!!!!!!
34
ANY QUESTIONS?
35

More Related Content

Similar to Geopy Module in Python

Geo search introduction
Geo search introductionGeo search introduction
Geo search introductionkenshin03
 
Geolocation in Drupal
Geolocation in DrupalGeolocation in Drupal
Geolocation in DrupalMediacurrent
 
LocationTech Projects
LocationTech ProjectsLocationTech Projects
LocationTech ProjectsJody Garnett
 
Getting Started with Geospatial Data in MongoDB
Getting Started with Geospatial Data in MongoDBGetting Started with Geospatial Data in MongoDB
Getting Started with Geospatial Data in MongoDBMongoDB
 
LocationTech Projects
LocationTech ProjectsLocationTech Projects
LocationTech ProjectsJody Garnett
 
How to use geolocation in react native apps
How to use geolocation in react native appsHow to use geolocation in react native apps
How to use geolocation in react native appsInnovationM
 
OSCON july 2011
OSCON july 2011OSCON july 2011
OSCON july 2011chelm
 
TDC2016SP - Trilha NoSQL
TDC2016SP - Trilha NoSQLTDC2016SP - Trilha NoSQL
TDC2016SP - Trilha NoSQLtdc-globalcode
 
Visualization and Level-of-detail of Metadata for Interactive Exploration of ...
Visualization and Level-of-detail of Metadata for Interactive Exploration of ...Visualization and Level-of-detail of Metadata for Interactive Exploration of ...
Visualization and Level-of-detail of Metadata for Interactive Exploration of ...Cybera Inc.
 
Location based services for Nokia X and Nokia Asha using Geo2tag
Location based services for Nokia X and Nokia Asha using Geo2tagLocation based services for Nokia X and Nokia Asha using Geo2tag
Location based services for Nokia X and Nokia Asha using Geo2tagMicrosoft Mobile Developer
 
Mapping, GIS and geolocating data in Java
Mapping, GIS and geolocating data in JavaMapping, GIS and geolocating data in Java
Mapping, GIS and geolocating data in JavaJoachim Van der Auwera
 
Postgres Vision 2018: PostGIS and Spatial Extensions
Postgres Vision 2018: PostGIS and Spatial ExtensionsPostgres Vision 2018: PostGIS and Spatial Extensions
Postgres Vision 2018: PostGIS and Spatial ExtensionsEDB
 
Location Analytics Real-Time Geofencing using Kafka
Location Analytics Real-Time Geofencing using KafkaLocation Analytics Real-Time Geofencing using Kafka
Location Analytics Real-Time Geofencing using KafkaGuido Schmutz
 
Getting Oriented with MapKit: Everything you need to get started with the new...
Getting Oriented with MapKit: Everything you need to get started with the new...Getting Oriented with MapKit: Everything you need to get started with the new...
Getting Oriented with MapKit: Everything you need to get started with the new...John Wilker
 
Location Analytics - Real-Time Geofencing using Kafka
Location Analytics - Real-Time Geofencing using Kafka Location Analytics - Real-Time Geofencing using Kafka
Location Analytics - Real-Time Geofencing using Kafka Guido Schmutz
 
GeoNode intro and demo
GeoNode intro and demoGeoNode intro and demo
GeoNode intro and demoPaolo Corti
 
Lucene/Solr Spatial in 2015: Presented by David Smiley
Lucene/Solr Spatial in 2015: Presented by David SmileyLucene/Solr Spatial in 2015: Presented by David Smiley
Lucene/Solr Spatial in 2015: Presented by David SmileyLucidworks
 

Similar to Geopy Module in Python (20)

Geo search introduction
Geo search introductionGeo search introduction
Geo search introduction
 
Geolocation in Drupal
Geolocation in DrupalGeolocation in Drupal
Geolocation in Drupal
 
LocationTech Projects
LocationTech ProjectsLocationTech Projects
LocationTech Projects
 
Getting Started with Geospatial Data in MongoDB
Getting Started with Geospatial Data in MongoDBGetting Started with Geospatial Data in MongoDB
Getting Started with Geospatial Data in MongoDB
 
Android GNSS in Nutshell
Android GNSS in NutshellAndroid GNSS in Nutshell
Android GNSS in Nutshell
 
LocationTech Projects
LocationTech ProjectsLocationTech Projects
LocationTech Projects
 
How to use geolocation in react native apps
How to use geolocation in react native appsHow to use geolocation in react native apps
How to use geolocation in react native apps
 
OSCON july 2011
OSCON july 2011OSCON july 2011
OSCON july 2011
 
QGIS training class 3
QGIS training class 3QGIS training class 3
QGIS training class 3
 
TDC2016SP - Trilha NoSQL
TDC2016SP - Trilha NoSQLTDC2016SP - Trilha NoSQL
TDC2016SP - Trilha NoSQL
 
Visualization and Level-of-detail of Metadata for Interactive Exploration of ...
Visualization and Level-of-detail of Metadata for Interactive Exploration of ...Visualization and Level-of-detail of Metadata for Interactive Exploration of ...
Visualization and Level-of-detail of Metadata for Interactive Exploration of ...
 
Geolocation and Mapping
Geolocation and MappingGeolocation and Mapping
Geolocation and Mapping
 
Location based services for Nokia X and Nokia Asha using Geo2tag
Location based services for Nokia X and Nokia Asha using Geo2tagLocation based services for Nokia X and Nokia Asha using Geo2tag
Location based services for Nokia X and Nokia Asha using Geo2tag
 
Mapping, GIS and geolocating data in Java
Mapping, GIS and geolocating data in JavaMapping, GIS and geolocating data in Java
Mapping, GIS and geolocating data in Java
 
Postgres Vision 2018: PostGIS and Spatial Extensions
Postgres Vision 2018: PostGIS and Spatial ExtensionsPostgres Vision 2018: PostGIS and Spatial Extensions
Postgres Vision 2018: PostGIS and Spatial Extensions
 
Location Analytics Real-Time Geofencing using Kafka
Location Analytics Real-Time Geofencing using KafkaLocation Analytics Real-Time Geofencing using Kafka
Location Analytics Real-Time Geofencing using Kafka
 
Getting Oriented with MapKit: Everything you need to get started with the new...
Getting Oriented with MapKit: Everything you need to get started with the new...Getting Oriented with MapKit: Everything you need to get started with the new...
Getting Oriented with MapKit: Everything you need to get started with the new...
 
Location Analytics - Real-Time Geofencing using Kafka
Location Analytics - Real-Time Geofencing using Kafka Location Analytics - Real-Time Geofencing using Kafka
Location Analytics - Real-Time Geofencing using Kafka
 
GeoNode intro and demo
GeoNode intro and demoGeoNode intro and demo
GeoNode intro and demo
 
Lucene/Solr Spatial in 2015: Presented by David Smiley
Lucene/Solr Spatial in 2015: Presented by David SmileyLucene/Solr Spatial in 2015: Presented by David Smiley
Lucene/Solr Spatial in 2015: Presented by David Smiley
 

Recently uploaded

IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...
IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...
IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...RajaP95
 
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptxDecoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptxJoão Esperancinha
 
Introduction to Multiple Access Protocol.pptx
Introduction to Multiple Access Protocol.pptxIntroduction to Multiple Access Protocol.pptx
Introduction to Multiple Access Protocol.pptxupamatechverse
 
SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )Tsuyoshi Horigome
 
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escortsranjana rawat
 
247267395-1-Symmetric-and-distributed-shared-memory-architectures-ppt (1).ppt
247267395-1-Symmetric-and-distributed-shared-memory-architectures-ppt (1).ppt247267395-1-Symmetric-and-distributed-shared-memory-architectures-ppt (1).ppt
247267395-1-Symmetric-and-distributed-shared-memory-architectures-ppt (1).pptssuser5c9d4b1
 
Porous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writingPorous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writingrakeshbaidya232001
 
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLS
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLSMANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLS
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLSSIVASHANKAR N
 
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...ranjana rawat
 
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...Christo Ananth
 
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...Dr.Costas Sachpazis
 
Processing & Properties of Floor and Wall Tiles.pptx
Processing & Properties of Floor and Wall Tiles.pptxProcessing & Properties of Floor and Wall Tiles.pptx
Processing & Properties of Floor and Wall Tiles.pptxpranjaldaimarysona
 
College Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service NashikCollege Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service NashikCall Girls in Nagpur High Profile
 
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur High Profile
 
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...ranjana rawat
 
Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝
Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝
Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝soniya singh
 
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...ranjana rawat
 
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...Call Girls in Nagpur High Profile
 

Recently uploaded (20)

IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...
IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...
IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...
 
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptxDecoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
 
Introduction to Multiple Access Protocol.pptx
Introduction to Multiple Access Protocol.pptxIntroduction to Multiple Access Protocol.pptx
Introduction to Multiple Access Protocol.pptx
 
SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )
 
★ CALL US 9953330565 ( HOT Young Call Girls In Badarpur delhi NCR
★ CALL US 9953330565 ( HOT Young Call Girls In Badarpur delhi NCR★ CALL US 9953330565 ( HOT Young Call Girls In Badarpur delhi NCR
★ CALL US 9953330565 ( HOT Young Call Girls In Badarpur delhi NCR
 
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
 
247267395-1-Symmetric-and-distributed-shared-memory-architectures-ppt (1).ppt
247267395-1-Symmetric-and-distributed-shared-memory-architectures-ppt (1).ppt247267395-1-Symmetric-and-distributed-shared-memory-architectures-ppt (1).ppt
247267395-1-Symmetric-and-distributed-shared-memory-architectures-ppt (1).ppt
 
Porous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writingPorous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writing
 
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLS
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLSMANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLS
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLS
 
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
 
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
 
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
 
Processing & Properties of Floor and Wall Tiles.pptx
Processing & Properties of Floor and Wall Tiles.pptxProcessing & Properties of Floor and Wall Tiles.pptx
Processing & Properties of Floor and Wall Tiles.pptx
 
9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf
9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf
9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf
 
College Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service NashikCollege Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
 
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
 
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
 
Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝
Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝
Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝
 
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
 
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...
 

Geopy Module in Python

  • 1. PRESENTATION ON GEOPY PYTHON MODULE PRESENT BY: Sayam Baidar(02) Sijan Bhandari(04) Rabina Twayana(29) Date:13 Feb 2020 1
  • 2. CONTENTS  Python Module  Introduction to GeoPy  Installation of GeoPy  Geocoding Vs Reverse Geocoding  Commonly Used method in GeoPy  Uses of GeoPy in Distance Calculation  Accessing data in GeoPy  Exception in GeoPy 2
  • 3. Python Module  A module is a file consisting of Python code.  A module can define functions, classes and variables.  A module can also include runnable code.  A module is a file containing Python definitions and statements 3
  • 4. Introduction to GeoPy  Geopy is a python module that includes geocoders class for calling several geocoding web services such as: • Open StreetMap Nominatim • ESRI ArcGIS • Google Geocoding API(V3) • Bing Maps API • Yandex • OpenMapQuest • NaviData • GeoNames • DeocodeFare etc 4
  • 5. Contd….  Makes easy to locate : • Co-ordinate • Address • Geographic location(Mountains, rivers etc) • Landmarks • Cities • Countries across the globe using geocoders and other data sources 5
  • 6. Installation using pip  pip is install by default if we are using python 2>=2.7.9 or python 3>=3.4  If not, then install pip or install latest python for windows which support pip from https://www.python.org/ 6
  • 7. To check installed pip version 7
  • 8. geopy installation  In command prompt run: pip install geopy 8
  • 9. Geocoder  A class for handling Geocoding and Reverse Geocoding  Geocoders define at least a geocode() method and a reverse() method.  Each geolocation service we might use, such as Google Maps, Bing Maps, or Nominatim etc, has its own class in geopy.geocoders  Geocoder accepts any settings needed to interact with its service, e.g., an API key, during its initialization.  An API key is a unique identifier used to authenticate a user, or developer to an API which allow communication with services. from geopy.geocoders import Nominatim geolocator=Nominatim(user_agent=“specify_your_app_name_here”) 9
  • 10. Geocoding Vs Reverse Geocoding Geocoding(Forward Geocoding) Reverse Geocoding The process of converting addresses (like a street address) into geographic coordinates (like latitude and longitude), The process of converting geographic coordinates into a human-readable address. Used to place markers on a map, or position the map. Used to find the address corresponding to a set of coordinates: Uses geocode() method Uses reverse() method 10
  • 11. Commonly used methods in geopy  geocode() Syntax: geocode(query) where, query(str) is address we wish to geocode  reverse() Syntax: reverse(query) where query is coordinates(lat,long) for which we wish to obtain human-readable addresses. Both method returns geopy.location.Location object 11
  • 12. geocode() method  Resolves given address into pair of coordinates Output: Kathmandu University, KU road, Kuttal, Srikhandapur, Dhulikhel, काभ्रेपलाञ्चोक, Bagmati Pradesh, 09771, Nepal (27.61866315, 85.53822627738802) 12
  • 13. How to get an API key for OpenMapQuest?  Signed-up first from https://developer.mapquest.com  Click on "Create a New Key"  Filled in "App Name"  Filled in "Callback URL“  Click on “Create app”  Click on uparrow of app name  Get API key for OpenMapQuest 13
  • 14. Geocoding using API key  Output: 27.6474649 85.3348047874904  Output using Nominatim: (27.61866315, 85.53822627738802) 14
  • 15. reverse() method  Resolve pair of co-ordinates to an address.  Output Kathmandu University, KU road, Kuttal, Srikhandapur, Dhulikhel, काभ्रेपलाञ्चोक, Bagmati Pradesh, 09771, Nepal (27.61866315, 85.53822627738802) 15
  • 16. Distance Calculation  GeoPy can calculate distance between two points.  Mainly two types of distance are calculated by GeoPy: • Great Circle Distance • Geodesic Distance 16
  • 17. Great Circle Distance  Great circle distance is the shortest distance between two points on the surface of a sphere  Uses spherical model of the Earth to calculate the surface distance between two points.  Syntax: great_circle (args1, args2) where args1=location1 co-ordinate value args2= location2 co-ordinate value 17
  • 19. Geodesic Distance  A geodesic is the shortest path between two points on a curved surface, analogous to a straight line on a plane surface  Uses ellipsoidal model of the Earth to calculate shortest distance between two point on the surface of Earth.  More accurate than great_circle distance  default is WGS-84 ellipsoid which is most globally accurate  Includes few other models in the distance.ELLIPSOIDS dictionary: • GRS-80 • GRS-67 • Airy (1830) • Intl 1924 • Clarke (1880) 19
  • 20.  Syntax geodesic(args1, args2)  Output 386.2061376343612 km 386.20613763557986 km 20
  • 21. Data  Class geopy.location.Location  Access the properties • address: return type- Unicode Location as a formatted string returned by the geocoder, depending on the service • latitude: return type- float Location’s latitude • longitude: return type –float Location’s longitude • altitude :return type- float Location’s altitude. • raw: return type-dict Location’s raw, unparsed geocoder response. 21
  • 22. 22
  • 23. Contd..  Class geopy.point.Point  A geodetic point with latitude, longitude, and altitude.  Latitude and longitude are floating point values in degrees, minutes, seconds. Altitude is a floating point value in kilometers.  Points can be created in a number of ways….. 23
  • 24.  Output 41 30m 0s S, 81 0m 0s W 41 30m 0s S, 81 0m 0s W 41 30m 0s S, 81 0m 0s W, 2.5km 23 26m 22s N, 23 27m 30s E, 33.796224km 3 26m 22s N, 23 27m 30s E 24
  • 26. Exception  In Python, all exceptions must be instances of a class that derives from BaseException, then Exception and the GeopyError  Geopy-specific exceptions are all inherited from GeopyError.  Three Exception class are inherited from GeopyError Class. They are • ConfigurationError When instantiating a geocoder, the arguments given were invalid. • GeocoderNotFound Caller requested the geocoder matching a string, e.g., "google" > GoogleV3, but no geocoder could be found. 26
  • 27. Contd • GeocoderServiceError  There was an exception caused when calling the remote geocoding service, and no more specific exception could be raised by geopy.  When calling geocoders’ geocode or reverse methods, this is the most generic exception that can be raised, and any non-geopy exception will be caught and turned into this. 27
  • 29. EXCEPTION DESCRIPTION GeocoderQueryError Either geopy detected input that would cause a request to fail, or a request was made and the remote geocoding service responded that the request was bad GeocoderUnavailable when it was not possible to establish a connection to the remote geocoding service GeocoderParseError Geopy could not parse the service’s response. This is probably due to a bug in geopy. GeocoderInsufficientPrivileges The remote geocoding service refused to fulfill a request using the account credentials given. GeocoderAuthenticationFailure The remote geocoding service rejected the API key, geocoder instantiated with. GeocoderTimedOut The call to the geocoding service was aborted because no response has been received within the timeout argument .Some services are just consistently slow, and a higher timeout may be needed to use them. 29
  • 33. REFRENCES  GeoPy’s documentation. (2017, February 2). Retrieved January 13, 2020, from GeoPy Stable: https://geopy.readthedocs.io/en/stable/  Python, 3.8.1. (2019, December 18). Retrieved January 7, 2020, from https://www.python.org/downloads/  Reddy., G. C. (2019, September 1). Python Modules. Retrieved January 11, 2020, from Python Tutorials for Beginners: http://www.gcreddy.com/python/python-modules/
  • 34. THANK YOU FOR YOUR ATTENTATION!!!!!! 34