ian
06-18-2003, 09:33 AM
I'm very new to mappoint so please forgive me if this has been answered before. i want to display the results of a databse query on a map. the language is delphi. here is my code.
var vGuid : TGuid;
curLat, CurLong, CurScore:real;
objLocTst:location;
ObjPin:Pushpin;
i:integer;
begin
i:=0;
OleContainer.CreateObject('MapPoint.Map.NA.9', False);
OleContainer.DoVerb(1);
OleContainer.OleObjectInterface.GetUserClassID(vGu id);
FMap := IDispatch(OleContainer.OleObject) as _Map;
FMap.DataSets.AddPushpinSet('70 plus');
with DM.ADOQ do
begin
First;
// while not Eof do
for i:=0 to 100 do //just do a subset for debugging
begin
CurLong := DM.ADOQ.FieldByName('longitude_x').AsFloat; //longitude
CurLat := DM.ADOQ.FieldByName('latitude_y').AsFloat;//latitude
CurScore := DM.ADOQ.FieldByName('homogeneity_score').Value; //what needs to be plotted as a function of lat, long
objLocTst := FMap.GetLocation(curLat, CurLong,1) ;
objPin := FMap.AddPushpin(objLocTst, floattostr(CurScore));
objPin.BalloonState := geoDisplayNone ;
objPin.Cut ;
Next;
end;
end;
// FMap.
end;
this runs fine but i never get anything displayed. i think i'm missing something fundamental. can anyone help? thanks
var vGuid : TGuid;
curLat, CurLong, CurScore:real;
objLocTst:location;
ObjPin:Pushpin;
i:integer;
begin
i:=0;
OleContainer.CreateObject('MapPoint.Map.NA.9', False);
OleContainer.DoVerb(1);
OleContainer.OleObjectInterface.GetUserClassID(vGu id);
FMap := IDispatch(OleContainer.OleObject) as _Map;
FMap.DataSets.AddPushpinSet('70 plus');
with DM.ADOQ do
begin
First;
// while not Eof do
for i:=0 to 100 do //just do a subset for debugging
begin
CurLong := DM.ADOQ.FieldByName('longitude_x').AsFloat; //longitude
CurLat := DM.ADOQ.FieldByName('latitude_y').AsFloat;//latitude
CurScore := DM.ADOQ.FieldByName('homogeneity_score').Value; //what needs to be plotted as a function of lat, long
objLocTst := FMap.GetLocation(curLat, CurLong,1) ;
objPin := FMap.AddPushpin(objLocTst, floattostr(CurScore));
objPin.BalloonState := geoDisplayNone ;
objPin.Cut ;
Next;
end;
end;
// FMap.
end;
this runs fine but i never get anything displayed. i think i'm missing something fundamental. can anyone help? thanks