Quantcast
Channel: GMap.NET - Great Maps for Windows Forms & Presentation
Viewing all 3384 articles
Browse latest View live

New Post: Using own satellite images

$
0
0
i mean, there is no built-in functionality, but you can render basically whatever you want on top of the map

New Post: check if markers are in polygon section or not

$
0
0
i have some markers om map, and 5 points that make a polygon,
how can i know polygon include markers or not
sorry for my bad english

New Post: check if markers are in polygon section or not

New Post: Drawing on the map

$
0
0
What you could do:

define 2 class variables:

private bool bStartnewRoute = true;

private GMapRoute route = null;

in your mouse down:

If bStartNewRoute is true, set it to false, create a new route and add startpoint. If bStartNewRoute is false, set it to true and add endpoint. Now you can add as many flight lines as you want.

If you need more help, I can send you some code, but try for yourself first :-)

New Post: Drawing on the map

$
0
0
I appreciate that. I've been paddling in circles over this. My HELLS YEAH has become a pffffttt.
I understand the creation of a switch (as in on / off). Yep, I can do that for sure.
So if new flight line, then make a new route as below ?

GMapRoute route_1 = new GMapRoute(new List<PointLatLng>(), "Route");

New Post: How to check is a point (marker) in some area or not?

$
0
0
How does it work? Is sorting or Clock-wise-ness required?
Is it on wikipedia or such??
I just ran it and it seems too good to be true.

        static void Main(string[] args)
        {
            List<PointLatLng> PontosPolig = new List<PointLatLng>();

            PointLatLng p1 = new PointLatLng(0, 0);
            PointLatLng p2 = new PointLatLng(2, 0);
            PointLatLng p3 = new PointLatLng(2, 2);
            PointLatLng p4 = new PointLatLng(0, 2);

            PontosPolig.Add(p1);
            PontosPolig.Add(p2);
            PontosPolig.Add(p3);
            PontosPolig.Add(p4);

            bool retval = false;

            retval= FindPoint(1.0, 1.0, PontosPolig);
            retval = FindPoint(10.0, 10.0, PontosPolig);
            retval = FindPoint(0.0, 0.0, PontosPolig);
            retval = FindPoint(-1.0, -1.0, PontosPolig);

            retval = FindPoint(2.01, 1.0, PontosPolig);
            retval = FindPoint(1.0, 2.01, PontosPolig);

            retval = FindPoint(0.7, 0.7, PontosPolig);
            retval = FindPoint(0.01, 0.01, PontosPolig);
            retval = FindPoint(1.99, 1.99, PontosPolig);
            retval = FindPoint(0.001, 1.999, PontosPolig);

            retval = FindPoint(1.0, 2.01, PontosPolig);
        }

        public static bool FindPoint(double pointLat, double pointLng, List<PointLatLng> PontosPolig)
        {//                             X               y               
            int sides = PontosPolig.Count();
            int j = sides - 1;
            bool pointStatus = false;

            for (int i = 0; i < sides; i++)
            {
                if (PontosPolig[i].Lng < pointLng && PontosPolig[j].Lng >= pointLng ||
                    PontosPolig[j].Lng < pointLng && PontosPolig[i].Lng >= pointLng)
                {
                    if (PontosPolig[i].Lat + (pointLng - PontosPolig[i].Lng) /
                        (PontosPolig[j].Lng - PontosPolig[i].Lng) * (PontosPolig[j].Lat - PontosPolig[i].Lat) < pointLat)
                    {
                        pointStatus = !pointStatus;
                    }
                }
                j = i;
            }
            return pointStatus;
        }




    }
}

New Post: Drawing on the map

$
0
0
Re-use the route object, otherwise you cannot add the 2nd point!

In your mouse_down event handler:
if(bStartNewRoute)
{
   bStartNewRoute = false;
   route = new GMapRoute(new List<PointLatLng>(), "Route"); 
   route.points.Add...
}
else
{
   bStartNewRoute = true;
   route.points.Add...
   gMapControl1.UpdateRouteLocalPosition(route);
}

New Post: Useing GMap.Net in Labview

$
0
0
I have the same problem, any solution?

New Post: Rotate map and markers?

$
0
0
radioman,

You said windows forms now has integrated rotation. thanks great! can you point me in the direction of where I can change the map rotation? thank you!

New Post: How to check is a point (marker) in some area or not?

New Post: Useing GMap.Net in Labview

New Post: Rotate map and markers?

$
0
0
latest release has it, latest hot build has bugs, therefore it's disabled

p.s. map.Bearing = xxx

New Post: ShowDialog() Error Parameter is not valid

$
0
0
Xandolph: I had the same problem.
restrictedArea is a polygon.

Wrong way:
restrictedArea.Stroke.Brush = Brushes.Red;
restrictedArea.Stroke.Width = 1.2f;
restrictedArea.Fill = Brushes.Transparent;

Correct way:
restrictedArea.Stroke = new Pen(Color.Red);
restrictedArea.Stroke.Width = 1.2f;
restrictedArea.Fill = new SolidBrush(Color.Transparent);

New Post: Rotate map and markers?

$
0
0
Great that works. I was looking for "Rotation" properties and never happened to see "Bearing."

I am having some limited success, however. All my routes work fine. My normal map markers work fine. I do have one map marker which is an arrow representing your direction of travel: so that marker's OnRender function had code in it to do a RotationTransform and TranslateTransform already. So I just made a small modification to adjust for the rotation of the map as well - works great.

My issue is with GMapImage. Here was my original OnRender function which worked perfectly fine before I began rotating the map around:
public override void OnRender(Graphics g)
{
    if (image == null)
        return;

    Rectangle rect = new Rectangle(LocalPosition.X, LocalPosition.Y, Size.Width, Size.Height);
    g.DrawImage(image, rect);
    g.DrawRectangle(Outline, rect);    
}
So, naturally, I just did the transforming that I was used to doing with the arrow marker I described above to have it also rotate with the map:
public double MapBearing { get; set; }

public override void OnRender(Graphics g)
{
    if (image == null)
        return;

    g.RotateTransform(Convert.ToSingle(MapBearing));
    g.TranslateTransform(LocalPosition.X, LocalPosition.Y, System.Drawing.Drawing2D.MatrixOrder.Append);

    Rectangle rect = new Rectangle(0, 0, Size.Width, Size.Height);
    g.DrawImage(image, rect);
    g.DrawRectangle(Outline, rect);    
}
But this is not working at all. The image plots in different locations based on zoom and as I pan the map, it's moves wildly around the screen. Something is not tracking correctly to keep it aligned with the rotating map. Any suggestions?

I was worried that doing a rotation on the marker and then doing a rotation on the image was the problem but they are both on separate overlays, so I assume that is not the issue.

New Post: Drawing on the map

$
0
0
Xandolph;

With your help, I've got it drawing multiple lines like I want. At some point, I will need to modify a drawn line. Using the method as above, a new instance of "route" is being generated every time there is a "first" mouse down. I'm thinking that because of this method of creating a new instance of "route", perhaps all history is lost to revisit a drawn line to modify it. Its just something I've got to think about.

For now, sometimes, I need to re-position the map after the first mouse down, to pan to the next point. I'm using "gMapControl1_Paint" to draw my lines in real-time (as the mouse moves). This works real well for me. However, when I have to move the map (after the first mouse down), the beginning of the flight line stays in one place. And it should, because I'm drawing basically on the Form. I need to be able to convert "first mouse down lat / long" to screen coordinates, so when I move the map after the first mouse down, my flight line start stays where it should on the map. I'm trying to use:
              ............
    public Point FromLatLngToPixel(double lat, double lng, int zoom)
    {
        Point converted_to_screen_xy = new Point();
               return converted_to screen_xy;
    }
But I don't know how to call the function. I know I need to feed it the lat / lng and the zoom ratio, but I don't know the syntax.
          Point xx_yy = gMapControl1.gMap.FromLatLngToPixel(x_y, 10);
is not right.

New Post: Rotate map and markers?

$
0
0
I believe my problem is here: I do this every time I update the image of the GMapImage
standaloneHeatMap.Image = value;
var tl = MainMap.FromLatLngToLocal(heatTL);
var br = MainMap.FromLatLngToLocal(heatBR);
standaloneHeatMap.Position = heatTL;
standaloneHeatMap.Size = new System.Drawing.Size(br.X - tl.X, br.Y - tl.Y);
MainMap.Invalidate();
You'll see that I know the Lat and Lon I want for the top-left (TL) and bottom-right (BR) corners. But I am getting the local coordinates and assigning that as the size of the GMapImage, which I use for drawing the image. However, when the map is rotated, the local points that correspond to those Lat's and Lon's are messing up the size of the GMapImage.

Not sure how to tackle this.

New Post: Drawing on the map

$
0
0
Hi!
First of all, don't draw in gMapControl1_Paint, it is not necessary!

If you want to dynamically show the endpoint of the current flightline while moving the map, do the following:

Add TWO points (with the same coordinates!) in the Mouse_down event.

In the MouseMove event:

Set the 2nd point of your current route object to the point of the mouse event, if "bStartNewRoute" is false, then update the route to show it correctly:
        private void gMapControl1_MouseMove(object sender, MouseEventArgs e)
        {
            if(bStartNewRoute == false)
            {
                PointLatLng pos = map1.FromLocalToLatLng(e.X, e.Y);
                route.Points[1] = pos;
                gMapControl1.UpdateRouteLocalPosition(route);
            }
            
Make sure you don't add the point again in MouseDown event if(bStartNewRoute == false)!

If you want to change the routes you already added, you got to store them somewhere. A List<GMapRoute> should do the trick. But to move the points later is a bit tricky, you need to add some markers at start and end of route, if you need more help just tell me.

Greetings from Vienna, Austria :-)

New Post: Drawing on the map

$
0
0
Xandolph;

I gotta tell you, I was afraid to dump the _Paint thing because I'm familiar with it; but your instruction helped me to achieve EXACTLY what I want.

You should be a teacher !!!
AW

New Post: Cache gets mixed up

$
0
0
Hi,

Got the following problem. Cache gets mixed up when switching between providers.
I use a custom created provider and open street map in this example.

What steps (clean up cache ?) do I have to do before displaying the next map.

mGmapControl.ScaleMode = ScaleModes.Integer;

Caching mode is set to ServerandCache.

Memory cache:
mGmapControl.Manager.UseMemoryCache = true;
mGmapControl.LevelsKeepInMemmory = 6;

Secondairy cache:
I have made de DbId in Gmap public so the database cache does get mixed up when using the same provider for multiple maps.
mGmapControl.MapProvider.DbId = mGeographicDeviceMap.Id;

Primairy cache:
Set mGmapControl.CacheLocation = Path.GetDirectoryName(Application.ExecutablePath) + "\Gmap.Cache\" + mGeographicDeviceMap.Id + "\"; so each map has it's own SQLite db.

Use mGmapControl.ReloadMap(); when switching.

Image

New Post: Cache gets mixed up

$
0
0
each map provider should have constant DbId, and it is by default

just make new provider with unique GUID, and everything will work just fine
Viewing all 3384 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>