SlideShare a Scribd company logo
1 of 27
GeoPy Module in
Python
MEMBERS:
ASHMITA DHAKAL (07)
ROHIT GAUTAM (09)
PRASHANT THAPALIYA (29)
AAKASH THAPA (31)
1
Introduction to ‘geopy’
īļA module is a file containing Python definitions and statements.
īļgeopy - used for geocoding web services.
īļA Python 2 and 3 client.
īļMakes easier to geolocate:
īļAddresses
īļCities
īļCountries
īļLandmarks
along with co-ordinates and vice versa.
2
geopy and geocoders
īļgeopy provides geolocation across the globe
īļUses third-party (i.e. geocoders)
īļ Uses Google Maps, Bing Maps or Nominatim as geolocation sevices.
īļSuch services has its own class in geopy.geocoders
īļEach geocoder accepts the required settings or credentials to interact with
services
3
Installation of geopy
īļinstall geopy in command prompt by :
pip install geopy
4
Importing geopy module
īļIn order to use geopy module, the module should be imported.
īļThe module can be imported as:
from geopy import *
from geopy.geocoders import *
NOTE: executing geopy module for geolocation requires fast internet connection.
5
Available contents at geopy.geocoders
īļBaidu
īļBing
īļNominatim
īļArcGIS
īļWhat3Words
īļGoogleV3
īļEtc.
6
Nominatim
īļIs a search engine
īļAssociated with OpenStreetMap (OSM)
īļProvision for:
īļForward search (coordinate from address)
īļReverse search (look for data from coordinates)
7
Nominatim
īļNomination is used to mention the application name which is used in program
to geolocate the inputs.
īļNominatim is a search engine for OpenStreetMap data. This is the debugging
interface.
>>> from geopy.geocoders import Nominatim
>>> geolocator = Nominatim(user_agent=“OSM")
8
geopy module methods
īļMethods are the member of classes.
īļUse to perform specific task.
īļ An object method can only have access to the data known by that object.
īļVarious methods are explained in further slides.
9
geocode() method
īļgeocode() method is used to geolocate a query of given input address.
īļThe output of the given program is:
(27.6877024, 85.3345680822887)
from geopy import Nominatim
geolocator = Nominatim(user_agent="OSM")
location = geolocator.geocode("Liverpool International College")
print((location.latitude, location.longitude))
10
geocode() method
geocode(query, exactly_one=True, timeout=None)
Parameters:
â—Ļ query(String)= the address or query you wish to geocode.
â—Ļ exactly_one(bool)= Return one result or a list of results, if available.
â—Ļ Timeout(int)– Time, in seconds, to wait for the geocoding service to respond
11
reverse() method
Reverse(query, exactly_one=True,timeout=None,distance=None,wkid=4326)
Parameters:
â—Ļ query(geopy.point.Point, list or tupel of (latitude,longitude))=The coordinates for which you
wish to obtain the closest human-readable addresses.
â—Ļ exactly_one(bool)= Return one result,or a list?
â—Ļ timeout (int) – Time, in seconds, to wait for the geocoding service to respond
â—Ļ distance (int) – Distance from the query location, in meters, within which to search
â—Ļ wkid (string) – WKID to use for both input and output coordinates.
12
reverse() method
īļreverse() method is used to find the corresponding to a set of coordinates.
īļThe output of the given program is:
Kathmandu University, KU road, Kuttal, 28 Kilo, Dhulikhel, ā¤•ā¤žā¤­āĨā¤°āĨ‡ā¤Ēā¤˛ā¤žā¤žāĨā¤šāĨ‹ā¤•,
ā¤Ŧā¤žā¤—ā¤Žā¤¤āĨ€ ā¤…ā¤žāĨā¤šā¤˛, ā¤Žā¤§āĨā¤¯ā¤Žā¤žā¤žāĨā¤šā¤˛ ā¤ĩā¤ŋā¤•ā¤žā¤¸ ā¤•āĨā¤ˇāĨ‡ā¤¤āĨā¤°, 09771, ā¤¨āĨ‡ā¤Ēā¤žā¤˛
from geopy import *
geolocator = Nominatim(user_agent=“OSM")
location = geolocator.reverse((27.61866315,85.538226277388))
print(location.address)
13
īļgeocode and reverse return three types of values:
īļNone: when no value is found
īļLocation as geopy.location.Location object when argument is true
īļA list of geopy.location.Location object when exactly one is false
When response is not received in allotted timeout, exception is received
(geopy.exc.GeocoderTimedOut)
14
Unit Conversion
īļThere is provision of unit conversion on geopy in Geopy.units
īļDifferent units can be used for angle and distance conversion such as:
â—Ļ Angle: Degrees, minutes, seconds and radians
â—Ļ Distance: Mile, kilometer, feet, meter, nautical
15
Functions available for angle unit conversion are:
1. arcminutes(degrees=0, radians=0, arcseconds=0)
converts one of the input parameter into minutes
2. arcseconds(degrees=0, radians=0, arcminutes=0)
converts one of the input parameter into seconds
3. degrees(radians=0, arcminutes=0, arcseconds=0)
converts one of the input parameter into degrees.
4. radians(degrees=0, arcminutes=0, arcseconds=0)
converts one of the input parameter into radians.
īƒ˜There can be one or more arguments in each functions.
16
from geopy.units import *
print(degrees(radians= 3.14))
Output: 179.9087476710785
Functions available for distance conversion are:
1. feet( kilometres=0, meters=0, miles=0, nautical=0)
converts one of the input parameters into feet
2. kilometres(meters=0, miles=0, feet=0, nautical=0)
converts one of the input parameters into kilometres
3. meters( kilometres=0, miles=0, feet=0, nautical=0)
converts one of the input parameters into meters
4. miles( kilometres=0, meters=0, feet=0, nautical=0)
converts one of the input parameters into miles
5. nautical( kilometres=0, meters=0, miles=0, feet=0)
converts one of the input parameters into nautical
17
from geopy.units import *
print(feet(kilometers=90))
Output: 295275.59055118106
Distance Computation
īļcalculates distance between two points by:
īļGeodesic distance
īļshortest distance on the surface of an ellipsoidal model of the earth
īļGreat circle distance
īļuses a spherical model of the earth, using the mean earth radius as defined by the
International Union of Geodesy and Geophysics
18
geodesic() method
īļgeodesic() method is used to calculate the distance between two co-ordinates
with a default of the geodesic distance available as the function
geopy.distance.distance.
from geopy import *
from geopy import Nominatim
from geopy.distance import *
geolocator = Nominatim(user_agent="OSM")
location1 = geolocator.geocode("Kathmandu")
location2 = geolocator.geocode("Pokhara")
ktm = (location1.latitude,location1.longitude)
pkh= (location2.latitude,location2.longitude)
d=str(geodesic(ktm,pkh).kilometers)
print("Distance between Kathmandu and Pokhara is :"+d+"km"
19
geodesic() method
īļThe output of the given program is:
Distance between Kathmandu and Pokhara is :142.0431085720416km
20
great_circle()
īļCalculates distance from the method of great circle.
īļThe output is: Distance between Kathmandu and Pokhara is
:141.8939645114832km
21
from geopy import *
from geopy import Nominatim
from geopy.distance import great_circle
geolocator = Nominatim(user_agent="OSM")
location1 = geolocator.geocode("Kathmandu")
location2 = geolocator.geocode("Pokhara")
ktm = (location1.latitude,location1.longitude)
pkh= (location2.latitude,location2.longitude)
d=str(great_circle(ktm,pkh).kilometers)
print("Distance between Kathmandu and Pokhara is :"+d+"km")
Different ellipsoids are available for calculating distance between two
location but the default ellipsoid is WGS-84
The sets of ellipsoids available is:
model major (km) minor (km) flattening
ELLIPSOIDS = {'WGS-84': (6378.137, 6356.7523142, 1 /298.257223563),
'GRS-80': (6378.137, 6356.7523141, 1 / 298.257222101),
'Airy (1830)': (6377.563396, 6356.256909, 1 / 299.3249646),
'Intl 1924': (6378.388, 6356.911946, 1 / 297.0),
'Clarke (1880)': (6378.249145, 6356.51486955, 1 / 293.465),
'GRS-67': (6378.1600, 6356.774719, 1 / 298.25),
}
22
We can also can change the ellipsoid model used by the geodesic formulas like:
Here, ellipsoid GRS-80 is used.
23
from geopy import *
from geopy.distance import geodesic
print(distance.geodesic(27,35,ellipsoid='GRS-80').miles)
Output:551.1330125824877
from geopy import *
from geopy.distance import geodesic
print(geodesic(27,35 ,ellipsoid=(6377.0, 6356.0, 1 / 297.05)).miles)
Output:551.0256807403239
EXCEPTIONS
īļgeopy.exc.geopyError: all exceptions are inherited from GeopyError
īļgeopy.exc.GeocoderNotFound exception: when the string passed in geocode()
is not recognized.
īļgeopy.exc.GeocoderQueryError: when geopy detected input that cause
request to fail or if the geocoding service responded that request was bad.
īļgeopy.exc.GeocoderTimedOut: when no service has been received in the
given timeout argument
īļgeopy.exc.GeopyError: when no geocoder could be found.
īļEtc.
24
Uses of the module
īļCan be used during natural disaster assessment to locate the affected areas.
īļCan be used in extracting the filtered raw information from web services.
īļCan be used with various module.
for example: geopy with pandas is used to create a database in rows and columns.
25
References
īļURL: https://geopy.readthedocs.io/en/stable/
o Accessed date: 18th December,2018
īļURL:https://pypi.org/project/geopy/
o Accessed date: 18th December, 2018
īļURL:https://www.youtube.com/watch?v=5z4v4qX2_7c
o Accessed date: 19th December,2018
26
27

More Related Content

What's hot

Agile Methodology in Software Development
Agile Methodology in Software DevelopmentAgile Methodology in Software Development
Agile Methodology in Software DevelopmentRaghav Seth
 
Project Management 2.0
Project Management 2.0Project Management 2.0
Project Management 2.0Wrike
 
Agile Software Development Overview
Agile Software Development OverviewAgile Software Development Overview
Agile Software Development Overviewsunilkumar_
 
Software Project Management: Project Charter
Software Project Management: Project CharterSoftware Project Management: Project Charter
Software Project Management: Project CharterMinhas Kamal
 
Project Management With Scrum
Project Management With ScrumProject Management With Scrum
Project Management With ScrumTommy Norman
 
Agile effort estimation
Agile effort estimation Agile effort estimation
Agile effort estimation Elad Sofer
 
McCall's Quality Factors
McCall's Quality FactorsMcCall's Quality Factors
McCall's Quality FactorsUsman Khan
 
Agile Estimation & Capacity Planning
Agile Estimation & Capacity PlanningAgile Estimation & Capacity Planning
Agile Estimation & Capacity PlanningMazhar Khan
 
Overview of Agile Methodology
Overview of Agile MethodologyOverview of Agile Methodology
Overview of Agile MethodologyHaresh Karkar
 
Agile Requirements & Design
Agile Requirements & DesignAgile Requirements & Design
Agile Requirements & DesignMike Cottmeyer
 
Agile Software Development
Agile Software DevelopmentAgile Software Development
Agile Software DevelopmentSachith Perera
 
Agile Metrics: Value, Flow, Quality, Culture
Agile Metrics: Value, Flow, Quality, CultureAgile Metrics: Value, Flow, Quality, Culture
Agile Metrics: Value, Flow, Quality, CultureBrad Appleton
 
Agile-Scrum Methodology-An Introduction
Agile-Scrum Methodology-An IntroductionAgile-Scrum Methodology-An Introduction
Agile-Scrum Methodology-An IntroductionXBOSoft
 

What's hot (20)

Scrum In 15 Minutes
Scrum In 15 MinutesScrum In 15 Minutes
Scrum In 15 Minutes
 
Agile Methodology in Software Development
Agile Methodology in Software DevelopmentAgile Methodology in Software Development
Agile Methodology in Software Development
 
Agile Metrics
Agile MetricsAgile Metrics
Agile Metrics
 
Agile Overview
Agile OverviewAgile Overview
Agile Overview
 
Project Management 2.0
Project Management 2.0Project Management 2.0
Project Management 2.0
 
The Challenges of Agile Adoption
The Challenges of Agile AdoptionThe Challenges of Agile Adoption
The Challenges of Agile Adoption
 
Agile Software Development Overview
Agile Software Development OverviewAgile Software Development Overview
Agile Software Development Overview
 
Agile Methodology ppt
Agile Methodology pptAgile Methodology ppt
Agile Methodology ppt
 
Software Project Management: Project Charter
Software Project Management: Project CharterSoftware Project Management: Project Charter
Software Project Management: Project Charter
 
Project Management With Scrum
Project Management With ScrumProject Management With Scrum
Project Management With Scrum
 
Agile effort estimation
Agile effort estimation Agile effort estimation
Agile effort estimation
 
McCall's Quality Factors
McCall's Quality FactorsMcCall's Quality Factors
McCall's Quality Factors
 
Scrum best practices
Scrum best practicesScrum best practices
Scrum best practices
 
Agile Estimation & Capacity Planning
Agile Estimation & Capacity PlanningAgile Estimation & Capacity Planning
Agile Estimation & Capacity Planning
 
Overview of Agile Methodology
Overview of Agile MethodologyOverview of Agile Methodology
Overview of Agile Methodology
 
Agile Requirements & Design
Agile Requirements & DesignAgile Requirements & Design
Agile Requirements & Design
 
Agile Software Development
Agile Software DevelopmentAgile Software Development
Agile Software Development
 
Product Backlog Management
Product Backlog ManagementProduct Backlog Management
Product Backlog Management
 
Agile Metrics: Value, Flow, Quality, Culture
Agile Metrics: Value, Flow, Quality, CultureAgile Metrics: Value, Flow, Quality, Culture
Agile Metrics: Value, Flow, Quality, Culture
 
Agile-Scrum Methodology-An Introduction
Agile-Scrum Methodology-An IntroductionAgile-Scrum Methodology-An Introduction
Agile-Scrum Methodology-An Introduction
 

Similar to Geopy module in python

Geolocation on Rails
Geolocation on RailsGeolocation on Rails
Geolocation on Railsnebirhos
 
Geopy Module in Python
Geopy Module in PythonGeopy Module in Python
Geopy Module in PythonRabinaTwayana
 
Sample document
Sample documentSample document
Sample documentarunsethu87
 
Geo distance search with my sql presentation
Geo distance search with my sql presentationGeo distance search with my sql presentation
Geo distance search with my sql presentationGSMboy
 
Opensource gis development - part 2
Opensource gis development - part 2Opensource gis development - part 2
Opensource gis development - part 2Andrea Antonello
 
Localization using filtered dgps
Localization using filtered dgpsLocalization using filtered dgps
Localization using filtered dgpseSAT Journals
 
Develop a native application that uses GPS location.pptx
Develop a native application that uses GPS location.pptxDevelop a native application that uses GPS location.pptx
Develop a native application that uses GPS location.pptxvishal choudhary
 
Python en la Plataforma ArcGIS
Python en la Plataforma ArcGISPython en la Plataforma ArcGIS
Python en la Plataforma ArcGISXander Bakker
 
distance_matrix_ch
distance_matrix_chdistance_matrix_ch
distance_matrix_chvikasveshishth
 
Working with spatial trajectories in Boost Geometry
Working with spatial trajectories in Boost GeometryWorking with spatial trajectories in Boost Geometry
Working with spatial trajectories in Boost GeometryVissarion Fisikopoulos
 
Presentation on progress report of final year project(gps
Presentation on progress report of final year project(gpsPresentation on progress report of final year project(gps
Presentation on progress report of final year project(gpsWasim Akram
 
BallCatchingRobot
BallCatchingRobotBallCatchingRobot
BallCatchingRobotgauravbrd
 
MBLTDev: Phillip Connaughton, RunKepper
MBLTDev: Phillip Connaughton, RunKepper MBLTDev: Phillip Connaughton, RunKepper
MBLTDev: Phillip Connaughton, RunKepper e-Legion
 
Geek Sync | Having Fun with Spatial Data
Geek Sync | Having Fun with Spatial DataGeek Sync | Having Fun with Spatial Data
Geek Sync | Having Fun with Spatial DataIDERA Software
 
LinuxFest NW - Using Postgis To Add Some Spatial Flavor To Your App
LinuxFest NW - Using Postgis To Add Some Spatial Flavor To Your AppLinuxFest NW - Using Postgis To Add Some Spatial Flavor To Your App
LinuxFest NW - Using Postgis To Add Some Spatial Flavor To Your AppSteven Pousty
 
Smart Way to Track the Location in Android Operating System
Smart Way to Track the Location in Android Operating SystemSmart Way to Track the Location in Android Operating System
Smart Way to Track the Location in Android Operating SystemIOSR Journals
 
2017 RM-URISA Track: Spatial SQL - The Best Kept Secret in the Geospatial World
2017 RM-URISA Track:  Spatial SQL - The Best Kept Secret in the Geospatial World2017 RM-URISA Track:  Spatial SQL - The Best Kept Secret in the Geospatial World
2017 RM-URISA Track: Spatial SQL - The Best Kept Secret in the Geospatial WorldGIS in the Rockies
 

Similar to Geopy module in python (20)

Geolocation on Rails
Geolocation on RailsGeolocation on Rails
Geolocation on Rails
 
Geopy Module in Python
Geopy Module in PythonGeopy Module in Python
Geopy Module in Python
 
Sample document
Sample documentSample document
Sample document
 
Geo distance search with my sql presentation
Geo distance search with my sql presentationGeo distance search with my sql presentation
Geo distance search with my sql presentation
 
Opensource gis development - part 2
Opensource gis development - part 2Opensource gis development - part 2
Opensource gis development - part 2
 
Localization using filtered dgps
Localization using filtered dgpsLocalization using filtered dgps
Localization using filtered dgps
 
Develop a native application that uses GPS location.pptx
Develop a native application that uses GPS location.pptxDevelop a native application that uses GPS location.pptx
Develop a native application that uses GPS location.pptx
 
Python en la Plataforma ArcGIS
Python en la Plataforma ArcGISPython en la Plataforma ArcGIS
Python en la Plataforma ArcGIS
 
distance_matrix_ch
distance_matrix_chdistance_matrix_ch
distance_matrix_ch
 
Working with spatial trajectories in Boost Geometry
Working with spatial trajectories in Boost GeometryWorking with spatial trajectories in Boost Geometry
Working with spatial trajectories in Boost Geometry
 
Presentation on progress report of final year project(gps
Presentation on progress report of final year project(gpsPresentation on progress report of final year project(gps
Presentation on progress report of final year project(gps
 
BallCatchingRobot
BallCatchingRobotBallCatchingRobot
BallCatchingRobot
 
MBLTDev: Phillip Connaughton, RunKepper
MBLTDev: Phillip Connaughton, RunKepper MBLTDev: Phillip Connaughton, RunKepper
MBLTDev: Phillip Connaughton, RunKepper
 
Week 4
Week 4Week 4
Week 4
 
Mining gps data
Mining gps dataMining gps data
Mining gps data
 
Geek Sync | Having Fun with Spatial Data
Geek Sync | Having Fun with Spatial DataGeek Sync | Having Fun with Spatial Data
Geek Sync | Having Fun with Spatial Data
 
LinuxFest NW - Using Postgis To Add Some Spatial Flavor To Your App
LinuxFest NW - Using Postgis To Add Some Spatial Flavor To Your AppLinuxFest NW - Using Postgis To Add Some Spatial Flavor To Your App
LinuxFest NW - Using Postgis To Add Some Spatial Flavor To Your App
 
Smart Way to Track the Location in Android Operating System
Smart Way to Track the Location in Android Operating SystemSmart Way to Track the Location in Android Operating System
Smart Way to Track the Location in Android Operating System
 
2017 RM-URISA Track: Spatial SQL - The Best Kept Secret in the Geospatial World
2017 RM-URISA Track:  Spatial SQL - The Best Kept Secret in the Geospatial World2017 RM-URISA Track:  Spatial SQL - The Best Kept Secret in the Geospatial World
2017 RM-URISA Track: Spatial SQL - The Best Kept Secret in the Geospatial World
 
Pycon2011
Pycon2011Pycon2011
Pycon2011
 

Recently uploaded

Artificial-Intelligence-in-Electronics (K).pptx
Artificial-Intelligence-in-Electronics (K).pptxArtificial-Intelligence-in-Electronics (K).pptx
Artificial-Intelligence-in-Electronics (K).pptxbritheesh05
 
Software and Systems Engineering Standards: Verification and Validation of Sy...
Software and Systems Engineering Standards: Verification and Validation of Sy...Software and Systems Engineering Standards: Verification and Validation of Sy...
Software and Systems Engineering Standards: Verification and Validation of Sy...VICTOR MAESTRE RAMIREZ
 
complete construction, environmental and economics information of biomass com...
complete construction, environmental and economics information of biomass com...complete construction, environmental and economics information of biomass com...
complete construction, environmental and economics information of biomass com...asadnawaz62
 
CCS355 Neural Networks & Deep Learning Unit 1 PDF notes with Question bank .pdf
CCS355 Neural Networks & Deep Learning Unit 1 PDF notes with Question bank .pdfCCS355 Neural Networks & Deep Learning Unit 1 PDF notes with Question bank .pdf
CCS355 Neural Networks & Deep Learning Unit 1 PDF notes with Question bank .pdfAsst.prof M.Gokilavani
 
Heart Disease Prediction using machine learning.pptx
Heart Disease Prediction using machine learning.pptxHeart Disease Prediction using machine learning.pptx
Heart Disease Prediction using machine learning.pptxPoojaBan
 
Instrumentation, measurement and control of bio process parameters ( Temperat...
Instrumentation, measurement and control of bio process parameters ( Temperat...Instrumentation, measurement and control of bio process parameters ( Temperat...
Instrumentation, measurement and control of bio process parameters ( Temperat...121011101441
 
Correctly Loading Incremental Data at Scale
Correctly Loading Incremental Data at ScaleCorrectly Loading Incremental Data at Scale
Correctly Loading Incremental Data at ScaleAlluxio, Inc.
 
UNIT III ANALOG ELECTRONICS (BASIC ELECTRONICS)
UNIT III ANALOG ELECTRONICS (BASIC ELECTRONICS)UNIT III ANALOG ELECTRONICS (BASIC ELECTRONICS)
UNIT III ANALOG ELECTRONICS (BASIC ELECTRONICS)Dr SOUNDIRARAJ N
 
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
 
Concrete Mix Design - IS 10262-2019 - .pptx
Concrete Mix Design - IS 10262-2019 - .pptxConcrete Mix Design - IS 10262-2019 - .pptx
Concrete Mix Design - IS 10262-2019 - .pptxKartikeyaDwivedi3
 
🔝9953056974🔝!!-YOUNG call girls in Rajendra Nagar Escort rvice Shot 2000 nigh...
🔝9953056974🔝!!-YOUNG call girls in Rajendra Nagar Escort rvice Shot 2000 nigh...🔝9953056974🔝!!-YOUNG call girls in Rajendra Nagar Escort rvice Shot 2000 nigh...
🔝9953056974🔝!!-YOUNG call girls in Rajendra Nagar Escort rvice Shot 2000 nigh...9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
Introduction-To-Agricultural-Surveillance-Rover.pptx
Introduction-To-Agricultural-Surveillance-Rover.pptxIntroduction-To-Agricultural-Surveillance-Rover.pptx
Introduction-To-Agricultural-Surveillance-Rover.pptxk795866
 
Comparative Analysis of Text Summarization Techniques
Comparative Analysis of Text Summarization TechniquesComparative Analysis of Text Summarization Techniques
Comparative Analysis of Text Summarization Techniquesugginaramesh
 
Risk Assessment For Installation of Drainage Pipes.pdf
Risk Assessment For Installation of Drainage Pipes.pdfRisk Assessment For Installation of Drainage Pipes.pdf
Risk Assessment For Installation of Drainage Pipes.pdfROCENODodongVILLACER
 
Introduction to Machine Learning Unit-3 for II MECH
Introduction to Machine Learning Unit-3 for II MECHIntroduction to Machine Learning Unit-3 for II MECH
Introduction to Machine Learning Unit-3 for II MECHC Sai Kiran
 
Past, Present and Future of Generative AI
Past, Present and Future of Generative AIPast, Present and Future of Generative AI
Past, Present and Future of Generative AIabhishek36461
 
Application of Residue Theorem to evaluate real integrations.pptx
Application of Residue Theorem to evaluate real integrations.pptxApplication of Residue Theorem to evaluate real integrations.pptx
Application of Residue Theorem to evaluate real integrations.pptx959SahilShah
 

Recently uploaded (20)

Artificial-Intelligence-in-Electronics (K).pptx
Artificial-Intelligence-in-Electronics (K).pptxArtificial-Intelligence-in-Electronics (K).pptx
Artificial-Intelligence-in-Electronics (K).pptx
 
Software and Systems Engineering Standards: Verification and Validation of Sy...
Software and Systems Engineering Standards: Verification and Validation of Sy...Software and Systems Engineering Standards: Verification and Validation of Sy...
Software and Systems Engineering Standards: Verification and Validation of Sy...
 
complete construction, environmental and economics information of biomass com...
complete construction, environmental and economics information of biomass com...complete construction, environmental and economics information of biomass com...
complete construction, environmental and economics information of biomass com...
 
CCS355 Neural Networks & Deep Learning Unit 1 PDF notes with Question bank .pdf
CCS355 Neural Networks & Deep Learning Unit 1 PDF notes with Question bank .pdfCCS355 Neural Networks & Deep Learning Unit 1 PDF notes with Question bank .pdf
CCS355 Neural Networks & Deep Learning Unit 1 PDF notes with Question bank .pdf
 
Heart Disease Prediction using machine learning.pptx
Heart Disease Prediction using machine learning.pptxHeart Disease Prediction using machine learning.pptx
Heart Disease Prediction using machine learning.pptx
 
Instrumentation, measurement and control of bio process parameters ( Temperat...
Instrumentation, measurement and control of bio process parameters ( Temperat...Instrumentation, measurement and control of bio process parameters ( Temperat...
Instrumentation, measurement and control of bio process parameters ( Temperat...
 
Exploring_Network_Security_with_JA3_by_Rakesh Seal.pptx
Exploring_Network_Security_with_JA3_by_Rakesh Seal.pptxExploring_Network_Security_with_JA3_by_Rakesh Seal.pptx
Exploring_Network_Security_with_JA3_by_Rakesh Seal.pptx
 
young call girls in Green Park🔝 9953056974 🔝 escort Service
young call girls in Green Park🔝 9953056974 🔝 escort Serviceyoung call girls in Green Park🔝 9953056974 🔝 escort Service
young call girls in Green Park🔝 9953056974 🔝 escort Service
 
Correctly Loading Incremental Data at Scale
Correctly Loading Incremental Data at ScaleCorrectly Loading Incremental Data at Scale
Correctly Loading Incremental Data at Scale
 
UNIT III ANALOG ELECTRONICS (BASIC ELECTRONICS)
UNIT III ANALOG ELECTRONICS (BASIC ELECTRONICS)UNIT III ANALOG ELECTRONICS (BASIC ELECTRONICS)
UNIT III ANALOG ELECTRONICS (BASIC ELECTRONICS)
 
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
 
Concrete Mix Design - IS 10262-2019 - .pptx
Concrete Mix Design - IS 10262-2019 - .pptxConcrete Mix Design - IS 10262-2019 - .pptx
Concrete Mix Design - IS 10262-2019 - .pptx
 
young call girls in Rajiv Chowk🔝 9953056974 🔝 Delhi escort Service
young call girls in Rajiv Chowk🔝 9953056974 🔝 Delhi escort Serviceyoung call girls in Rajiv Chowk🔝 9953056974 🔝 Delhi escort Service
young call girls in Rajiv Chowk🔝 9953056974 🔝 Delhi escort Service
 
🔝9953056974🔝!!-YOUNG call girls in Rajendra Nagar Escort rvice Shot 2000 nigh...
🔝9953056974🔝!!-YOUNG call girls in Rajendra Nagar Escort rvice Shot 2000 nigh...🔝9953056974🔝!!-YOUNG call girls in Rajendra Nagar Escort rvice Shot 2000 nigh...
🔝9953056974🔝!!-YOUNG call girls in Rajendra Nagar Escort rvice Shot 2000 nigh...
 
Introduction-To-Agricultural-Surveillance-Rover.pptx
Introduction-To-Agricultural-Surveillance-Rover.pptxIntroduction-To-Agricultural-Surveillance-Rover.pptx
Introduction-To-Agricultural-Surveillance-Rover.pptx
 
Comparative Analysis of Text Summarization Techniques
Comparative Analysis of Text Summarization TechniquesComparative Analysis of Text Summarization Techniques
Comparative Analysis of Text Summarization Techniques
 
Risk Assessment For Installation of Drainage Pipes.pdf
Risk Assessment For Installation of Drainage Pipes.pdfRisk Assessment For Installation of Drainage Pipes.pdf
Risk Assessment For Installation of Drainage Pipes.pdf
 
Introduction to Machine Learning Unit-3 for II MECH
Introduction to Machine Learning Unit-3 for II MECHIntroduction to Machine Learning Unit-3 for II MECH
Introduction to Machine Learning Unit-3 for II MECH
 
Past, Present and Future of Generative AI
Past, Present and Future of Generative AIPast, Present and Future of Generative AI
Past, Present and Future of Generative AI
 
Application of Residue Theorem to evaluate real integrations.pptx
Application of Residue Theorem to evaluate real integrations.pptxApplication of Residue Theorem to evaluate real integrations.pptx
Application of Residue Theorem to evaluate real integrations.pptx
 

Geopy module in python

  • 1. GeoPy Module in Python MEMBERS: ASHMITA DHAKAL (07) ROHIT GAUTAM (09) PRASHANT THAPALIYA (29) AAKASH THAPA (31) 1
  • 2. Introduction to ‘geopy’ īļA module is a file containing Python definitions and statements. īļgeopy - used for geocoding web services. īļA Python 2 and 3 client. īļMakes easier to geolocate: īļAddresses īļCities īļCountries īļLandmarks along with co-ordinates and vice versa. 2
  • 3. geopy and geocoders īļgeopy provides geolocation across the globe īļUses third-party (i.e. geocoders) īļ Uses Google Maps, Bing Maps or Nominatim as geolocation sevices. īļSuch services has its own class in geopy.geocoders īļEach geocoder accepts the required settings or credentials to interact with services 3
  • 4. Installation of geopy īļinstall geopy in command prompt by : pip install geopy 4
  • 5. Importing geopy module īļIn order to use geopy module, the module should be imported. īļThe module can be imported as: from geopy import * from geopy.geocoders import * NOTE: executing geopy module for geolocation requires fast internet connection. 5
  • 6. Available contents at geopy.geocoders īļBaidu īļBing īļNominatim īļArcGIS īļWhat3Words īļGoogleV3 īļEtc. 6
  • 7. Nominatim īļIs a search engine īļAssociated with OpenStreetMap (OSM) īļProvision for: īļForward search (coordinate from address) īļReverse search (look for data from coordinates) 7
  • 8. Nominatim īļNomination is used to mention the application name which is used in program to geolocate the inputs. īļNominatim is a search engine for OpenStreetMap data. This is the debugging interface. >>> from geopy.geocoders import Nominatim >>> geolocator = Nominatim(user_agent=“OSM") 8
  • 9. geopy module methods īļMethods are the member of classes. īļUse to perform specific task. īļ An object method can only have access to the data known by that object. īļVarious methods are explained in further slides. 9
  • 10. geocode() method īļgeocode() method is used to geolocate a query of given input address. īļThe output of the given program is: (27.6877024, 85.3345680822887) from geopy import Nominatim geolocator = Nominatim(user_agent="OSM") location = geolocator.geocode("Liverpool International College") print((location.latitude, location.longitude)) 10
  • 11. geocode() method geocode(query, exactly_one=True, timeout=None) Parameters: â—Ļ query(String)= the address or query you wish to geocode. â—Ļ exactly_one(bool)= Return one result or a list of results, if available. â—Ļ Timeout(int)– Time, in seconds, to wait for the geocoding service to respond 11
  • 12. reverse() method Reverse(query, exactly_one=True,timeout=None,distance=None,wkid=4326) Parameters: â—Ļ query(geopy.point.Point, list or tupel of (latitude,longitude))=The coordinates for which you wish to obtain the closest human-readable addresses. â—Ļ exactly_one(bool)= Return one result,or a list? â—Ļ timeout (int) – Time, in seconds, to wait for the geocoding service to respond â—Ļ distance (int) – Distance from the query location, in meters, within which to search â—Ļ wkid (string) – WKID to use for both input and output coordinates. 12
  • 13. reverse() method īļreverse() method is used to find the corresponding to a set of coordinates. īļThe output of the given program is: Kathmandu University, KU road, Kuttal, 28 Kilo, Dhulikhel, ā¤•ā¤žā¤­āĨā¤°āĨ‡ā¤Ēā¤˛ā¤žā¤žāĨā¤šāĨ‹ā¤•, ā¤Ŧā¤žā¤—ā¤Žā¤¤āĨ€ ā¤…ā¤žāĨā¤šā¤˛, ā¤Žā¤§āĨā¤¯ā¤Žā¤žā¤žāĨā¤šā¤˛ ā¤ĩā¤ŋā¤•ā¤žā¤¸ ā¤•āĨā¤ˇāĨ‡ā¤¤āĨā¤°, 09771, ā¤¨āĨ‡ā¤Ēā¤žā¤˛ from geopy import * geolocator = Nominatim(user_agent=“OSM") location = geolocator.reverse((27.61866315,85.538226277388)) print(location.address) 13
  • 14. īļgeocode and reverse return three types of values: īļNone: when no value is found īļLocation as geopy.location.Location object when argument is true īļA list of geopy.location.Location object when exactly one is false When response is not received in allotted timeout, exception is received (geopy.exc.GeocoderTimedOut) 14
  • 15. Unit Conversion īļThere is provision of unit conversion on geopy in Geopy.units īļDifferent units can be used for angle and distance conversion such as: â—Ļ Angle: Degrees, minutes, seconds and radians â—Ļ Distance: Mile, kilometer, feet, meter, nautical 15
  • 16. Functions available for angle unit conversion are: 1. arcminutes(degrees=0, radians=0, arcseconds=0) converts one of the input parameter into minutes 2. arcseconds(degrees=0, radians=0, arcminutes=0) converts one of the input parameter into seconds 3. degrees(radians=0, arcminutes=0, arcseconds=0) converts one of the input parameter into degrees. 4. radians(degrees=0, arcminutes=0, arcseconds=0) converts one of the input parameter into radians. īƒ˜There can be one or more arguments in each functions. 16 from geopy.units import * print(degrees(radians= 3.14)) Output: 179.9087476710785
  • 17. Functions available for distance conversion are: 1. feet( kilometres=0, meters=0, miles=0, nautical=0) converts one of the input parameters into feet 2. kilometres(meters=0, miles=0, feet=0, nautical=0) converts one of the input parameters into kilometres 3. meters( kilometres=0, miles=0, feet=0, nautical=0) converts one of the input parameters into meters 4. miles( kilometres=0, meters=0, feet=0, nautical=0) converts one of the input parameters into miles 5. nautical( kilometres=0, meters=0, miles=0, feet=0) converts one of the input parameters into nautical 17 from geopy.units import * print(feet(kilometers=90)) Output: 295275.59055118106
  • 18. Distance Computation īļcalculates distance between two points by: īļGeodesic distance īļshortest distance on the surface of an ellipsoidal model of the earth īļGreat circle distance īļuses a spherical model of the earth, using the mean earth radius as defined by the International Union of Geodesy and Geophysics 18
  • 19. geodesic() method īļgeodesic() method is used to calculate the distance between two co-ordinates with a default of the geodesic distance available as the function geopy.distance.distance. from geopy import * from geopy import Nominatim from geopy.distance import * geolocator = Nominatim(user_agent="OSM") location1 = geolocator.geocode("Kathmandu") location2 = geolocator.geocode("Pokhara") ktm = (location1.latitude,location1.longitude) pkh= (location2.latitude,location2.longitude) d=str(geodesic(ktm,pkh).kilometers) print("Distance between Kathmandu and Pokhara is :"+d+"km" 19
  • 20. geodesic() method īļThe output of the given program is: Distance between Kathmandu and Pokhara is :142.0431085720416km 20
  • 21. great_circle() īļCalculates distance from the method of great circle. īļThe output is: Distance between Kathmandu and Pokhara is :141.8939645114832km 21 from geopy import * from geopy import Nominatim from geopy.distance import great_circle geolocator = Nominatim(user_agent="OSM") location1 = geolocator.geocode("Kathmandu") location2 = geolocator.geocode("Pokhara") ktm = (location1.latitude,location1.longitude) pkh= (location2.latitude,location2.longitude) d=str(great_circle(ktm,pkh).kilometers) print("Distance between Kathmandu and Pokhara is :"+d+"km")
  • 22. Different ellipsoids are available for calculating distance between two location but the default ellipsoid is WGS-84 The sets of ellipsoids available is: model major (km) minor (km) flattening ELLIPSOIDS = {'WGS-84': (6378.137, 6356.7523142, 1 /298.257223563), 'GRS-80': (6378.137, 6356.7523141, 1 / 298.257222101), 'Airy (1830)': (6377.563396, 6356.256909, 1 / 299.3249646), 'Intl 1924': (6378.388, 6356.911946, 1 / 297.0), 'Clarke (1880)': (6378.249145, 6356.51486955, 1 / 293.465), 'GRS-67': (6378.1600, 6356.774719, 1 / 298.25), } 22
  • 23. We can also can change the ellipsoid model used by the geodesic formulas like: Here, ellipsoid GRS-80 is used. 23 from geopy import * from geopy.distance import geodesic print(distance.geodesic(27,35,ellipsoid='GRS-80').miles) Output:551.1330125824877 from geopy import * from geopy.distance import geodesic print(geodesic(27,35 ,ellipsoid=(6377.0, 6356.0, 1 / 297.05)).miles) Output:551.0256807403239
  • 24. EXCEPTIONS īļgeopy.exc.geopyError: all exceptions are inherited from GeopyError īļgeopy.exc.GeocoderNotFound exception: when the string passed in geocode() is not recognized. īļgeopy.exc.GeocoderQueryError: when geopy detected input that cause request to fail or if the geocoding service responded that request was bad. īļgeopy.exc.GeocoderTimedOut: when no service has been received in the given timeout argument īļgeopy.exc.GeopyError: when no geocoder could be found. īļEtc. 24
  • 25. Uses of the module īļCan be used during natural disaster assessment to locate the affected areas. īļCan be used in extracting the filtered raw information from web services. īļCan be used with various module. for example: geopy with pandas is used to create a database in rows and columns. 25
  • 26. References īļURL: https://geopy.readthedocs.io/en/stable/ o Accessed date: 18th December,2018 īļURL:https://pypi.org/project/geopy/ o Accessed date: 18th December, 2018 īļURL:https://www.youtube.com/watch?v=5z4v4qX2_7c o Accessed date: 19th December,2018 26
  • 27. 27

Editor's Notes

  1. (2a + b)/3 = 6371.0087714150598 kilometers approx 6371.009 km (for WGS-84)