How to Find Nearest City or Location in Stata Using GEONEAR Command

  Рет қаралды 2,203

The Data Hall

The Data Hall

Күн бұрын

The geodist command is used to calculate the distance between two locations but we need to use geonear command to find the nearest city, locations within specific kilo meters or miles or limit the number of nearest locations in Stata.
Download exercise files:
payhip.com/b/9...
Download the code (do and data file) from following link:
thedatahall.co...
Best 10 Introductory Econometrics Books
thedatahall.co...
Data Management Using Stata: A Practical Handbook by Michael N. Mitchell
amzn.to/3HEULlc
A Gentle Introduction to Stata, by Alan C. Acock
amzn.to/3HBgdY4
amzn.to/3LWOALz (paperback)
A Visual Guide to Stata Graphics, by Michael N. Mitchell
amzn.to/42qLpkG
Regression Models for Categorical Dependent Variables Using Stata, by J. Scott Long and Jeremy Freese
amzn.to/3NDoFtC
Website: thedatahall.com
Disclaimer: Some links are affiliate links that help the channel at no cost to you.

Пікірлер: 13
@sknowlak4435
@sknowlak4435 3 жыл бұрын
how to get geoNear from one collecction to another collection??
@davitadunts7428
@davitadunts7428 2 жыл бұрын
Hi, thank you very much for your lecture. Geonear command provides wrong distance when I use coordinates from Google Maps. Do you have any idea why that happens? Thank you.
@thedatahall
@thedatahall 2 жыл бұрын
What do u mean by wrong distance? This command calculate distance by air and not by road. So the miles shown by the command and Google map will be different by small amount. If you are calculating large distances the probably it will not mattee
@davitadunts7428
@davitadunts7428 2 жыл бұрын
@@thedatahall I know that it calculates the distance by air. The problem is that it calculates the distance accurately when I use the coordinates provided in shape file, but fails to do so when I manually input the coordinates (I don't see any logical reasons why). I solved the issue by reducing the Earths radius to 4000km, with this parameter the distances are accurate to 200m.
@davitadunts7428
@davitadunts7428 2 жыл бұрын
@@thedatahall By any chance, do you know how to calculate the distance from multiple cities to a border line? Thank you?
@thedatahall
@thedatahall 2 жыл бұрын
I am afraid no
@horusleung123
@horusleung123 4 жыл бұрын
Hi, when I try to run this function, it states that “latitude (variable) or longitude (variable) not constant within (variable) group” May I know what is the problem here?
@thedatahall
@thedatahall 4 жыл бұрын
What is the exact command that you are running and can you upload screenshot of the data.
@horusleung123
@horusleung123 4 жыл бұрын
@@thedatahall So I have a bus stops data set and monitor station data set and I want to find the nearest monitor station for each stops. I am using the bus stops data set as master table and my command is as followed: geonear STOP_ID latitude longitude using station_latlon_1 8 (fix).dta , neighbors(station_n latitude longitude) Then it said "latitude or longitude not constant within STOP_ID group" I am not sure what happened. Btw I don't think I can upload a screenshot here
@thedatahall
@thedatahall 4 жыл бұрын
Thats interesting. Your command is correct, there might be some issue with dataset. If you can send me some sample dataset at info@thedatahall.com i will look into it.
@stefanospapalysandrou238
@stefanospapalysandrou238 Жыл бұрын
Hey! I have exactly the same problem.. Can you please provide some help? I am working on my thesis and this is the only part I am missing.
@thedatahall
@thedatahall Жыл бұрын
Hi, sure please email me the code and sample data at info@thedatahall.com and i shall look into it
Learn R in 39 minutes
38:56
Equitable Equations
Рет қаралды 674 М.
ПРИКОЛЫ НАД БРАТОМ #shorts
00:23
Паша Осадчий
Рет қаралды 5 МЛН
Bike vs Super Bike Fast Challenge
00:30
Russo
Рет қаралды 23 МЛН
А ВЫ ЛЮБИТЕ ШКОЛУ?? #shorts
00:20
Паша Осадчий
Рет қаралды 7 МЛН
No, Einstein Didn’t Solve the Biggest Problem in Physics
8:04
Sabine Hossenfelder
Рет қаралды 96 М.
Calculate Daily, Weekly, Monthly Stock Return in R
21:46
The Data Hall
Рет қаралды 181
How I Would Learn GIS (If I Had To Start Over)
24:46
Matt Forrest
Рет қаралды 77 М.
Winning Codeforces Round 971 (Div. 4) in honor of @que_tourist
1:39:42
Solving real world data science tasks with Python Pandas!
1:26:07
Keith Galli
Рет қаралды 1,5 МЛН
Panel Data Models (Pooled OLS, FE, RE, LSDVs) in STATA
13:39
Justin Eloriaga
Рет қаралды 58 М.
Portfolio Sorting in R | Univariate portfolio sorting
19:49
The Data Hall
Рет қаралды 131
Standardization and Normalization in Stata
8:58
The Data Hall
Рет қаралды 629
Introduction to difference in differences in Stata 17
59:06
SDAS TechTips @sdas_anz
Рет қаралды 10 М.
ПРИКОЛЫ НАД БРАТОМ #shorts
00:23
Паша Осадчий
Рет қаралды 5 МЛН