Register  |  Login
ThinkGeo - GPS Tracking and Mapping Solutions  |  Visit the Wiki  |  Find us on: Twitter Facebook Google+ LinkedIn

Discussion Forums

The online community for users of Map Suite GIS components

lines on .tif
Last Post 01-08-2009 03:53 PM by Val. 5 Replies.
Printer Friendly
Sort:
PrevPrev NextNext
You are not authorized to post a reply.
Author Messages
MarcelUser is Offline
Level 1
Level 1
Posts:3
Avatar

--
01-05-2009 07:02 AM

Hello,

I have a Problem with to draw lines.I have .tif maps with world files. Now I want draw a Track on the map with gps-coordinates. The coordinates come from a Database.
How can I do that?

ScottUser is Offline
MVP
MVP
Posts:732
Avatar

--
01-05-2009 07:46 PM
Marcel,

You can get all coordinates from the database first, then drawing them on the map, please see the following code:

// Retrieve a Datatable containing the track Information from your database.
DataTable TrackData = GetTrackData();

Points pointCollection = new Points();
PointShape point = new PointShape();
foreach(DataRow row in TrackData.Rows)
{
point = new PointShape(Convert.ToDouble(row["Longitude"]), Convert.ToDouble(row["Latitude"]));
points.Add(point);
}

LineShape line = new LineShape(points);
LineMapShape trackLine = new LineMapShape(line);
map1.MapShapes.Add(trackLine);
map1.Refresh();

Also you need set a correct extent for the map so that it can display the line map shape correctly.

If you have any questions please let me know,

Thanks,
MarcelUser is Offline
Level 1
Level 1
Posts:3
Avatar

--
01-06-2009 04:29 AM

I can draw a line on a .shp file. but not on a .tiff with a world File.
On your sample application in Layer -> Image Layer, are the coordinates they are displayed in the left bottom corner realy curious(-32213°21'37"/27724°20'05").
Could that be the problem?

ValUser is Offline
MVP
MVP
Posts:1634
Avatar

--
01-06-2009 04:20 PM
In the sample app "ImageLayer', the unit of the map is not Decimal Degrees (longitude and Latitude), it is in meters. When the unit is in meter or feet, it means that the data has been projected to some projections such as State Plane or UTM. If you use the data from a GPS unit and you want to display it on a map on another projection, you are going to have to know the projection parameters and apply the projection to the GPS point. That way the map and the GPS point are in the same projection and the GPS point can display properly on the map. Let's take an example:

-You have your map in StatePlane in Feet for Texas Central zone as in the case of the sample app "Projection".
-You have the GPS unit giving you coordinates in Geodetic or Lat/Long (Decimal Degrees).

You are going to have to project the GPS point to StatePlane in order to see it properly on the map. You use that following projection class:

Dim geoStatePlane83 As New GeodeticStatePlane83(StatePlaneZones.Texas_Central, StatePlaneUnit.Feet, StatePlaneGeodeticDirection.GeodeticToStatePlane)

-If you are using a MapShape, you can use the Projection property:

Dim PointShape As New PointShape(-97.89, 30.35)
Dim PMS As New PointMapShape(PointShape, New PointSymbol(PointStyleEnum.Circle, New GeoSolidBrush(GeoColor.SimpleColors.Red), 12))
PMS.Projection = geoStatePlane83


-You can also use the ProjectPoint method of the Projection class:

Dim PointShape As New PointShape(geoStatePlane83.ProjectPoint(-97.89, 30.35))
Dim PMS As New PointMapShape(PointShape, New PointSymbol(PointStyleEnum.Circle, New GeoSolidBrush(GeoColor.SimpleColors.Red), 12))

From this example, I think you see how you need to know the projection information of your data.




MarcelUser is Offline
Level 1
Level 1
Posts:3
Avatar

--
01-08-2009 09:43 AM
I have done anything wrong.

Add a new *.tif map, in my cas from switzerland or germany.

this.map1.MapUnit = MapLengthUnits.DecimalDegrees;
map1.ImageLayers.Add(new ImageLayer("doqq_cir_unionsprg_ny.tif"));

Add a new point

GeodeticStatePlane83 geo = new GeodeticStatePlane83(StatePlaneZones.Texas_Central, StatePlaneUnit.Feet, StatePlaneGeodeticDirection.GeodeticToStatePlane);
PointShape point = new PointShape(-97.89, 30.35);
PointMapShape pms = new PointMapShape(point, new PointSymbol(PointStyleEnum.Circle, new GeoSolidBrush(GeoColor.SimpleColors.Red), 12));
pms.Projection = geo;
ValUser is Offline
MVP
MVP
Posts:1634
Avatar

--
01-08-2009 03:53 PM
In my last thread, I talked about State Plane projection as an example, to illustrate how to go to and from a projection. I emphasized the importance of understanding the projection information of your data. Until you don't know more about the projection information of your own data, I can not help you further.
You are not authorized to post a reply.

Active Forums 4.2