Hello, I am new to this forum, but I have been working with MapWinGIS for the past few months and I have to say, the features of this software are incredible.
I am creating a mapping application that takes in plain .JPGs, and allows a user to geo-rectify, so that the user may plot information in real time from a GPS instrument. I can draw
the image no problem. I can see the cursor coordinates in the top right of the window. I cannot retrieve those coordinates so that I can use them for my translation calculations (affine transformation). I have seen a similar thread here, but it appears their image was already rectified to give the Lat/Long. (this is not yet the case).
Label5.Text = AxMap.MousePosition.X Label6.Text = AxMap.MousePosition.Y XMapPixel.Text = AxMap.MousePosition.X YMapPixel.Text = AxMap.MousePosition.Y 'This converts mouse position X/Y to Lat/Long AxMap1.PixelToProj(AxMap.MousePosition.X, AxMap.MousePosition.Y, mapX, mapY) 'displays lat/long in textboxes with 6 decimal places Label5.Text = Format(mapX, "###.######") Label6.Text = Format(mapY, "##.######")
axmap.mouseposition.x / y seems to give the mouse cursor location within the application window itself, not the mapwinGIS window. As a result, and a result I think of there not being a worldfile(yet), the coordinates displayed in label 5/6 from the above snippet are also useless. The only coordinates that would be useful are the ones already on the screen, but I cannot seem to access them.
I have also tried using the Axmap1.latitude/Axmap1.Longitude calls, but they return nothing.
Below is the code snippet showing how I add the image. I am also setting the originalXllCenter and YllCenter so that I can make the top left corner the picture origin. this seems to work, as I can reference the coordinates within the map window, and the center of the top left pixel gives me a 0,0 reading.
Dim imgX, imgY As Double Dim sfWorld As New MapWinGIS.Image sfWorld.Open("C:\Users\ericp\Desktop\market.jpg") AxMap1.AddLayer(sfWorld, True) imageH = sfWorld.OriginalHeight 'these two lines get the image height and width imageW = sfWorld.OriginalWidth imgX = 0 'these two lines set where the image is drawn imgY = (imageH - 1) 'in this case, i want it to have an origin in the center of the top-left pixel sfWorld.OriginalXllCenter = imgX sfWorld.OriginalYllCenter = (imgY * -1)
In version 5.2, what is the best way of retrieving an images coordinates that are displayed within the map window?