Jump to content

Display Coordinates on a map


_Vlad
 Share

Recommended Posts

Hello,

I have a list of coordinates that must be placed correctly on a map.
I've been trying to solve this problem for almost a week and I can't figure it out.'

I tried to solve this using several UDFs or various solutions but none helped me out to come up with something.

Any tips for a possible solution to this problem and dispaly the coordinates on the right place?

 

Thank you very much for your attention.

123.png

directions.png

Link to comment
Share on other sites

For example I have coordinate 109.3.

I want to have a point which should be displayed in the right place according to the direction of the coordinate (ex : 109.3 will be somewhere between East (E) 90* and South (S) 180*.

Link to comment
Share on other sites

Unfortunately not. I just got the image from somewhere.

I'll try my best to see what I can do.

I also found out the Excel UDF which can create a radial chart but I don't figure out how. I m still trying now using this.

It is ok if it's generated in Excel too.

Link to comment
Share on other sites

It doesn't really matter if it's displayed on this chart or other or through other methods.

Just a radial in which I can put this value and be displayed on a circle.

 

The thing is that I have a lot of maritime data i work with and i want to do a script to show me the dominant current and it's intensity from a range of time. (Each hour represents a value)

Link to comment
Share on other sites

Alright, my first intuition would be to use GDI+ to draw the circle and the points.  You would control everything (radius, center of the circle, circumference, etc...).  You can easily draw points also with it (see _GDIPlus_GraphicsDrawEllipse for both circle and points).  To know the number of pixels between each degree, you just divide the circumference by 360.

Once you have that you can calculate the x,y coordinates of a point based on its degree and the radius of the circle.  My geometry is very very far, so I cannot give you right now the method of calculating it.  Another solution would be to create a 2D array of coordinates for each of the 360 degree.  Then you can extrapolate the position for in between degrees.

Edit Found it, was not so complicated after all :

Const $radius = 100

  For $angle = 0 to 360 step 45
    $radian = _Radian($angle)
    $x = Round($radius *  cos($radian), 2)
    $y = Round($radius *  sin($radian), 2)
    ConsoleWrite("x = " & $x & " / y = " & $y & @CRLF)
  Next

That is calculating X,Y position from the center of the circle.  You will need to convert those coordinates to fit the 0,0 (upper left) client window position.  Also the 0 degree is right most position of the circle going counter-clockwise while yours is the top most going clockwise (conversion required here also).

Good luck.

Edited by Nine
Link to comment
Share on other sites

7 hours ago, _Vlad said:

I don't really need a code to work just an idea of how I could do the code by myself.

Ya, but you got me hook.  So I didn't work (having fun) for nothing :

#include <GDIPlus.au3>
#include <GUIConstantsEx.au3>
#include <Math.au3>

Opt("MustDeclareVars", True)

Global Const $SIZE = 400, $BORDER = 50, $RADIUS = ($SIZE - 2 * $BORDER) / 2, $CIRCLE_SIZE = 4

_GDIPlus_Startup()

Example()

Func Example()
  Local Const $aDegree = [10, 92, 318, 323, 325, 327]

  Local $hGUI = GUICreate("GDI+", $SIZE, $SIZE)
  GUISetState(@SW_SHOW)

  Local $hGraphic = _GDIPlus_GraphicsCreateFromHWND($hGUI)
  Local $hPen = _GDIPlus_PenCreate(0xFFFF0000, $CIRCLE_SIZE)
  _GDIPlus_GraphicsSetSmoothingMode($hGraphic, $GDIP_SMOOTHINGMODE_HIGHQUALITY)
  _GDIPlus_GraphicsDrawEllipse($hGraphic, $BORDER, $BORDER, $SIZE - $BORDER * 2, $SIZE - $BORDER * 2, $hPen)

  Local $radian, $x, $y
  For $i = 0 To UBound($aDegree) - 1
    $radian = _Radian(Mod(450 - $aDegree[$i], 360))
    $x = Round($RADIUS * Cos($radian)) + $SIZE / 2 - $CIRCLE_SIZE
    $y = $SIZE / 2 - Round($RADIUS * Sin($radian)) - $CIRCLE_SIZE
    _GDIPlus_GraphicsFillEllipse($hGraphic, $x, $y, $CIRCLE_SIZE * 2, $CIRCLE_SIZE * 2)
  Next

  Do
  Until GUIGetMsg() = $GUI_EVENT_CLOSE

  _GDIPlus_PenDispose($hPen)
  _GDIPlus_GraphicsDispose($hGraphic)
EndFunc   ;==>Example

 

Edited by Nine
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...