0

Good day! I know how to create a points in a mapbasic having a single long/lat, but i wanted to create 10 points on a single coordinates without overlapping to each other but separated by about 5m radius apart from the given coordinates.

Any idea how should i start coding this.

br, Ivan

Ivan
  • 1
  • 3
  • I don't understand, do you want to create 10 points at one position or 10 points at different positions? – Wernfried Domscheit Jan 07 '15 at 12:14
  • thanks Wernfried. Actually, i only have one coordinates, which i could make a single point, but i have a another column variable value that i wanted to make, to create another points (around the clock) 5 meters apart from the single coordinates. – Ivan Jan 08 '15 at 12:35
  • Ok, distance of 5 meters. In which direction? – Wernfried Domscheit Jan 09 '15 at 07:19
  • it is possible around the clock or North/North East/etc. whichever is better. – Ivan Jan 11 '15 at 09:34

1 Answers1

0

In principal it looks like this

Dim x,y as Float
Dim offset as Integer

offset = 5 'distance 5 meters

'single coordinate
x = 1000
y= 2000

For i = 1 To 10
   Create Point (x + Cos(i * (360/10) * DEG_2_RAD) * offset, y + Sin(i * (360/10) * DEG_2_RAD) * offset)
Next

Please note, this works properly only for cartesian coordinate system, e.g. UTM. If you work on Lat/lon you have to do some additinal trigonometry for the offset.

Update

Have also a look at function CartesianOffset( object, angle, distance, units ) and CartesianOffsetXY( object, xoffset, yoffset, units ), maybe they are easier to use.

Dim obj as Object        
obj = CreatePoint(1000, 2000) 'Start point

For i = 1 To 10
    Create Point(CentroidX(obj), CentroidY(obj))
    obj = CartesianOffset(obj, -10, 5, "m") ' move by 5 meters for -10°
Next
Wernfried Domscheit
  • 54,457
  • 9
  • 76
  • 110