2 posts

## simulating on map image according to GPS coordinates.

Back to Forum: Tech Off
• Hi,
I need some suggestions regarding the following.

I am using mappoint webservice and using gps.net ,visualstudio.net 2003

1) I need to show the current location on the map with some icon  and from there I need to move/animate  the icon along x and y axis according to GPS coordinates received from GPS device until the destination (lat long) is reached.

Pls suggest me how can we convert lat long recieved from GPS to X and Y coordinates and how we show on the map received from Mapppoint webservice.

I planned to do this in the following way.

Since using GPS.net , I will be connected to virtual GPS device and get the current location and send that current location to mappoint webservice and return the map of that location plotting the current location with some icon.

In this returned map how can we move  icon according to GPS coordinates?? Pls guide me

• I believe you could do this relatively easily. Latitude is parallel to the equator and spans 180 degrees. The equator is 0 degrees, the north pole is +90 degrees, and the south pole is -90 degrees.

Longitude works in a similar fashion, but spans 360 degrees and the line of origin runs through Greenwich, England. Longitude is positive to the east of the line of reference, and negative to the west. So essentially you've got a grid with the origin in the center of the map, similar to the Cartesian plane.

So now what do you do? Calculate the height of your map and divide by 180. This will give you the spacing between lines of latitude. Calculate the width of your map and divide by 360, which will give you the spacing for the lines of longitude. You must now find a way to superimpose your position marker on your map using the grid you've come up with.

Make sense?

Edit: Obviously the above method is for a map of the world. For a smaller map that focuses on a location you're going to have to do some calculations in order to determine the scale and values of the longitude and latitude. Seems to me that a smaller location map is much more complex... espcially if you wanted to add support for scrolling the map as the GPS unit moves.