Convert PointLatLng for markers

Mar 5, 2009 at 10:41 AM
Hello,
at frist i need to say, THANK YOU for this great stuff.

How is it possible to set markers without having the LatLNG ?
is it possible to convert by MainMap.SetCurrentPositionByKeywords ?
If so , could you please post a little snippet of Code ?

I tried this Marker m1 = new Marker(start, MarkerType.Medium, MarkerColor.Green); and it works great.
But i dont have the right PointLatLng for every marker . Only postal code and street !!!

Hope to get a answer from you.

regards

ronny


Mar 5, 2009 at 1:12 PM
Gmaps.Instance.GetLatLngFromGeocoder("Europe");
Mar 5, 2009 at 1:27 PM
Yes,

i have done this before, but i dont know how to implement this in the following code:

this do not work !!

PointLatLng start = new PointLatLng(MainMap.GetLatLngFromGeocoder(txt_geosuch.Text));
                Marker m1 = new Marker(start, MarkerType.Medium, MarkerColor.Green);
                m1.Text = "Start: " + start.ToString();
                m1.TooltipMode = MarkerTooltipMode.OnMouseOver;
                MainMap.AddMarker(m1);


Mar 5, 2009 at 1:28 PM
Edited Mar 5, 2009 at 1:29 PM
GMaps.Instance.GetLatLngFromGeocoder
Mar 5, 2009 at 1:37 PM
sorry , but this did not work for me .

I dont have a GMaps.Instance...... !!
My project called gmap --> but also i did not find the class GetLatLng .

With MainMap i cann access the GetLatLng

I hope you can help me again ;-)
Mar 5, 2009 at 1:45 PM
use GMaps.Instance.GetLatLngFromGeocoder ;} or don't, as you wish
Mar 5, 2009 at 1:49 PM
Edited Mar 5, 2009 at 2:37 PM
ok,

but anywhere this kind of code still not working for me:

PointLatLng start = new PointLatLng(MainMap.GetLatLngFromGeocoder(txt_geosuch.Text));
                Marker m1 = new Marker(start, MarkerType.Medium, MarkerColor.Green);
                m1.Text = "Start: " + start.ToString();
                m1.TooltipMode = MarkerTooltipMode.OnMouseOver;
                MainMap.AddMarker(m1);
i get an error because of the constructor.

Can you please poste a little snippet which will work for me and please without : GMaps.Instance :-) (its not in my project, sorry and i dont know how to add it!)

FYI - i did not work with the windows . Presentation - i work with the windows.Forms.Trunk.Demo -
And i can add a marker with the lat/lng but not with the code above. !

Mar 5, 2009 at 3:46 PM
..i dont' get you, ist that so hard ;}

PointLatLng start = new PointLatLng(GMaps.Instance.GetLatLngFromGeocoder(txt_geosuch.Text));
                Marker m1 = new Marker(start, MarkerType.Medium, MarkerColor.Green);
                m1.Text = "Start: " + start.ToString();
                m1.TooltipMode = MarkerTooltipMode.OnMouseOver;
                MainMap.AddMarker(m1);
Mar 5, 2009 at 4:01 PM
i am so sorry but i think you dont read all of my post :-)

GMaps.Instance is only for Windows.presentation project, right?
I am working with the windows.FORM project called GmapApp :-)

So i dont have a GMaps.Instace ..... I hope you know what i mean.

Thats the reason :-)

And my code above with MainMap.      still not work because there comes a error with the constructor. Please be so kind to test it in your GmapApp project .... for me its not working :-(

Hope to get a solution for my problem , and sorry for the trouble with me .-)
Mar 5, 2009 at 4:03 PM
why so hard your mind to just test the code ;D
Mar 5, 2009 at 4:11 PM
radioman my friend,

i already tested the code in the project GMapAPP for Windows Forms ! But it still not work !!!!!
Fehler    1    Der Name "GMaps" ist im aktuellen Kontext nicht vorhanden.    C:\Dokumente und Einstellungen\******************\Eigene Dateien\Visual Studio 2008\Projects\Gmap\Gmap\Form1.cs    126    55    Gmap
My project dont can find GMaps !!!!!

I hope you understand now.


Mar 5, 2009 at 4:13 PM
finnaly some clarity ;} ..do you use Trunk version, or just old?
Mar 5, 2009 at 4:18 PM
uuuuh :-) yeah
i guess i use the Trunk Demo.Windows.Forms
Mar 5, 2009 at 4:20 PM
hm.. do you add GMap.NET.Core.dll reference?
Mar 5, 2009 at 4:25 PM
no, i only added the GMap.Net - should i add it ?
Mar 5, 2009 at 4:28 PM
..i think you use old version in trunk folder, because newest is in subfolder called Trunk, and in win forms version markers are not visible, but GMaps.Instance and it's function work ok. .Old version has old google version numbers, its out of date of using, ..and i still messing in wpf version ;/
Mar 5, 2009 at 4:43 PM
ok,

i tried this:

gmapnet\Trunk\Demo.WindowsForms

and created a button with following code:

private void button12_Click(object sender, EventArgs e)
      {
          PointLatLng start = new PointLatLng(GMaps.Instance.GetLatLngFromGeocoder("Bremen")); //cunstructor ERROR
          Marker m2 = new Marker(start, MarkerType.Medium, MarkerColor.Green); // not known in context
          m2.Text = "Start: " + start.ToString();
          m2.TooltipMode = MarkerTooltipMode.OnMouseOver;
          MainMap.AddMarker(m2);
          MainMap.ReloadMap();
      }


But i get a error also.
Fehler    1    "GMapNET.PointLatLng" enthält keinen Konstruktor, der 1-Argumente akzeptiert.    C:\Dokumente und Einstellungen\****\Desktop\gmapnet\Trunk\Demo.WindowsForms\Forms\MainForm.cs    359    31    Demo.WindowsForms
Fehler    2    Der Name "MarkerType" ist im aktuellen Kontext nicht vorhanden.    C:\Dokumente und Einstellungen\****\Desktop\gmapnet\Trunk\Demo.WindowsForms\Forms\MainForm.cs    360    57    Demo.WindowsForms
Fehler    3    Der Name "MarkerColor" ist im aktuellen Kontext nicht vorhanden.    C:\Dokumente und Einstellungen\****\Desktop\gmapnet\Trunk\Demo.WindowsForms\Forms\MainForm.cs    360    76    Demo.WindowsForms




Mar 5, 2009 at 4:47 PM
nop its gmapnet\Trunk\Trunk\Demo.WindowsForms
Mar 5, 2009 at 4:50 PM
exactly try this: gmap4dotnet-31939\Trunk\Solution\GMap.NET.sln
Mar 6, 2009 at 12:32 AM
So we can't use markers in the WinForms version?
Mar 6, 2009 at 6:12 AM
yup ;}
Mar 6, 2009 at 6:57 AM
häää ?
i am really confused about your statements radioman.
I use the Win.Forms Demo and i CAN add markers with lat/lng .Why you are saying that we cant use markers in Win.Forms ??????????
The only problem is only that we cant add markers with GetLatLngFromGeocoder .
Is there are no solution for it ?
Hope to hear from you good news ;-)
Mar 6, 2009 at 8:34 AM
you can do some things in release version, you cant do some things in trunk version, until next release confusion is our friend ;}
Mar 10, 2009 at 9:56 AM
Hi Radioman :-)

after updating the markers ( thank you) for Windows.Forms i used the Demo.Windows.Forms with this kind of Code:
GMapMarker m = new GMapMarkerGoogleGreen(GMaps.Instance.GetLatLngFromGeocoder("Hamburg"));

i am still using this project.: gmap\Trunk\Demo.WindowsForms
Why this is dont working ?
Made i a mistake ?
Hope to hear from you soon.
Ronny
Mar 10, 2009 at 12:58 PM
// add my city location for demo
PointLatLng? pos = GMaps.Instance.GetLatLngFromGeocoder("Lithuania, Vilnius");
if(pos != null)
{
    GMapMarker myCity = new GMapMarkerGoogleGreen(pos.Value);
    MainMap.Markers.Add(myCity);
}
Mar 10, 2009 at 4:04 PM
Hi radioman -

100000 thanks for this great working :-) THANK YOU

another: when you will implement the tooltip Coding for the markers for the win.Forms ?
It would help me so much.

Thanks and regards

ronny
Mar 10, 2009 at 5:05 PM
...soon, just need some copy/paste from old code ;}