Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
drawing line on map????

Subject: drawing line on map????

From: Divya

Date: 15 Feb, 2007 00:36:42

Message: 1 of 3

Using linem ...........we can draw line on map.........but i donno
why i am not able to draw a line.......
i am writing the foll code

figure
worldmap('india','patch');
linem([20 80],[25 85]);

syntax is linem(lat,lon)............but if i do so......i am geting a
single point on the map..........

can anyone help me out????

Subject: drawing line on map????

From: James

Date: 21 Feb, 2012 01:55:11

Message: 2 of 3

Divya,
In order to plot a line you need to give 4 coordinates A(lat1,lon1) B(lat2,lon2)
So to draw a line from A to B you would write:
linem([lat1;lat2],[lon1;lon2])
James
Divya <divya_puramshetty@yahoo.co.in> wrote in message <ef4ddea.-1@webcrossing.raydaftYaTP>...
> Using linem ...........we can draw line on map.........but i donno
> why i am not able to draw a line.......
> i am writing the foll code
>
> figure
> worldmap('india','patch');
> linem([20 80],[25 85]);
>
> syntax is linem(lat,lon)............but if i do so......i am geting a
> single point on the map..........
>
> can anyone help me out????

Subject: drawing line on map????

From: Rob Comer

Date: 21 Feb, 2012 23:24:11

Message: 3 of 3

Divya <divya_puramshetty@yahoo.co.in> wrote in message <ef4ddea.-1@webcrossing.raydaftYaTP>...
> Using linem ...........we can draw line on map.........but i donno
> why i am not able to draw a line.......
> i am writing the foll code
>
> figure
> worldmap('india','patch');
> linem([20 80],[25 85]);
>
> syntax is linem(lat,lon)............but if i do so......i am geting a
> single point on the map..........
>
> can anyone help me out????

In the syntax linem(LAT, LON), LAT is a vector of latitudes and LON is a vector of longitudes. But it looks as if you've grouped your coordinates in point-wise pairs. If, instead, you call linem like this:

linem([20 25],[80 85])

you'll get a line in the middle of your map connecting 20N, 80E to 25N, 85E.

Rob Comer
Mapping Toolbox Development
MathWorks

Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us