build a circle using the latitude and longitude values
Afficher commentaires plus anciens
Hi, I need to build a circle using the latitude and longitude values as the center of the circle.
busStop_latit; %array (28,1)
busStop_long; %array (28,1)
%latit and long with which I want to use to build the circle
I need to define "true" if new latitude and longitude values are internal to the constructed circle, "false" if these new values are external to the circle. How is it possible to build the circle and write these two conditions in matlab?
latitude; %matrix (3600,4)
longitude; %matrix (3600,4)
%i want to use only the 1st column oh the two matrix
pos_busStop=ones(28,1);
distance; %matrix (3600,4) and I want to use only the 1st column for this mtrix too
idx=zeros(3600,1);
for i=1:3600
if lat(i,1)<lat_new(1,:) && lon(i,1)<long_new(1,:)
idx(:,1)=1
end
pos_busStop(:,1)==distanza(idx,1);
end
3 commentaires
Adam Danz
le 2 Juil 2020
It sounds like you're trying to detect if a set of (lon,lat) coordinates are within a set distance to a target in which case you don't need to compute a circle. You just need to compute the distance of each (lon,lat) coordinate to the target and determine if it's less than or equal to the specified distance. That can be done using pdist2().
Angela Marino
le 2 Juil 2020
Adam Danz
le 2 Juil 2020
On second thought, pdist2() with 3600 coordinates may overwhelm that function. It would be easiest just to use the euclidean distance equation directly. I'll add a demo in the answers section that you can apply to your data.
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Google Earth dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
