Quantcast
Channel: DotSpatial
Viewing all articles
Browse latest Browse all 3973

New Post: How can I convert pixel coordinate to map coordinate for a gridline?

$
0
0
am2 wrote:
**jany_ wrote:**
You have to use pixel coordiates for g.DrawLine.
In your example you'd simply use
g.DrawLine(bluePen, ptf1, ptf2);
because that are the pixel coordinates that correspond to the geographic cooordinates (ptfpr1, ptfpr2) you wanted to use for drawing.
Hi,
I used this code but it returns (0,0,0) for both points..Where is my mistake?Can you please help me?
Thanks
            System.Drawing.Point ptf1 = new System.Drawing.Point(0, 0);
            System.Drawing.Point ptf2 = new System.Drawing.Point(300,400);
     
            DotSpatial.Topology.Coordinate ptfpr1 = new DotSpatial.Topology.Coordinate(map1.PixelToProj(ptf1));
            DotSpatial.Topology.Coordinate ptfpr2 = new DotSpatial.Topology.Coordinate(map1.PixelToProj(ptf2));
            g.DrawLine(drawingPen, ptf1, ptf2);
Any one can help me with?
I also noticed that the grid lines should change by changing in zoom of the map..How we can consider it?

Viewing all articles
Browse latest Browse all 3973

Trending Articles



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