# Can't draw a circle with radius in meters anymore in v5.2

**URL:** <https://mapwindow.discourse.group/t/cant-draw-a-circle-with-radius-in-meters-anymore-in-v5-2/753>\
**Category:** MapWinGIS\
**Created:** [October 23, 2020, 2:18pm UTC](https://mapwindow.discourse.group/t/cant-draw-a-circle-with-radius-in-meters-anymore-in-v5-2/753 "2020-10-23T14:18:24Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![pablodaniel](https://avatars.discourse-cdn.com/v4/letter/p/f6c823/32.png) [@pablodaniel](https://mapwindow.discourse.group/u/pablodaniel)\
**Post date:** [October 23, 2020, 2:18pm UTC](https://mapwindow.discourse.group/t/cant-draw-a-circle-with-radius-in-meters-anymore-in-v5-2/753/1 "2020-10-23T14:18:24Z")

</div>

Hello! I’m developing in VB6, and I have code that draws a circle with a certain radius in meters, using ConvertDistance to make the conversion. Howerver, my code stopped working when I updated the ocx from 5.1.1.0 to 5.2

Here is the relevant part of the code, can anyone figure out why it doesn’t work anymore and what would be a workaround? Thanks!

```auto
***On form load:***
 
Map1.Projection = tkMapProjection.PROJECTION_GOOGLE_MERCATOR
myId = tkTileProvider.ProviderCustom + 2
 
'Local server with openstreetmap tiles:
ans = Map1.Tiles.Providers.Add(myId, "Localhost Provider", "http://localhost/hot/{zoom}/{x}/{y}.png", tkTileProjection.SphericalMercator, 0, 16)
 
Map1.Tiles.ProviderId = myId
 
 
***On the draw function***
 
Dim m_Utils As New Utils
Dim valDist As Double, visDist As Double
               
Map1.ClearDrawings
Handle = Map1.NewDrawing(tkDrawReferenceList.dlSpatiallyReferencedList)
 
Map1.DegreesToProj sourceLon, sourceLat, X, Y
 
visDist = 3000
valDist = 200
 
ans = m_Utils.ConvertDistance(tkUnitsOfMeasure.umMeters, Map1.GeoProjection.LinearUnits, valDist)
valDist = valDist / Cos(sourceLat * PI / 180)
Map1.DrawWideCircle X, Y, valDist, RGB(120, 0, 0), False, 4, 255 'had to add alpha value 255 on v5.2, not optional
 
ans = m_Utils.ConvertDistance(tkUnitsOfMeasure.umMeters, Map1.GeoProjection.LinearUnits, visDist)
visDist= visDist/ Cos(sourceLat * PI / 180)
Map1.DrawWideCircle X, Y, visDist, RGB(0, 120, 0), False, 4, 255

```

Edit: To be more specific, the problem is that the circles don’t change their apparent radius when I change zoom levels in the map, they mantain ther size in pixels. Which shouldn’t happen, as I set dlSpatiallyReferencedList on the drawing layer.

Edit 2: I went back to v5.1.1 for now, and the same code is back to working as intended. I can stay with v5.1.1 for now, so this isn’t an urgent problem for me, but it’d be nice if it could be fixed (and then I can use the new alpha setting when drawing circles!)

---

<div class="post-metadata">

**Author:** ![jerryfaust](https://yyz2.discourse-cdn.com/free1/user_avatar/mapwindow.discourse.group/jerryfaust/32/378_2.png) [@jerryfaust](https://mapwindow.discourse.group/u/jerryfaust)\
**Post date:** [October 23, 2020, 4:20pm UTC](https://mapwindow.discourse.group/t/cant-draw-a-circle-with-radius-in-meters-anymore-in-v5-2/753/2 "2020-10-23T16:20:57Z")

</div>

Hello @pablodaniel

I have not tried running this yet, but at first glance, I can see that you’re calling `DrawWideCircle` rather than `DrawWideCircleEx` (in which you pass the Drawing Handle you got back from the `NewDrawing` call).

It’s a little obscure (I don’t know the history if the OCX development), but if you don’t specify a Handle, it will drawing using an internal default Handle, which may or may not be the same as the Handle you got back from `NewDrawing`. A discrepancy might only expose itself if you do multiple `NewDrawing` calls. If you have only done one, then your handle, as well as the internal handle, are likely both = 0 (zero).

Of course, none of this explains why the same code behaves differently from 5.1 to 5.2. I will paste this into a demo program and debug the issue. It may take a day or two to get to it, but it is important to get bugs resolved, so I will get to it.

Kind Regards,  
Jerry.

---

<div class="post-metadata">

**Author:** ![pablodaniel](https://avatars.discourse-cdn.com/v4/letter/p/f6c823/32.png) [@pablodaniel](https://mapwindow.discourse.group/u/pablodaniel)\
**Post date:** [October 23, 2020, 5:46pm UTC](https://mapwindow.discourse.group/t/cant-draw-a-circle-with-radius-in-meters-anymore-in-v5-2/753/3 "2020-10-23T17:46:50Z")

</div>

Hi @jerryfaust, thanks for looking into my problem.

I tried replacing the DrawWideCircle with DrawWideCircleEx calls, using the Handle value returned by NewDrawing, (registered the v5.2 ocx for the test) but there was no change in behavior, the circles still had a fixed radius in pixels at all zoom levels.

Another thing I noticed when using the 5.2 version of the ocx is that the scale bar and the zoom bar both dissapear, even when set as visible in the control properties.

---

<div class="post-metadata">

**Author:** ![Mathijs.Dumon](https://avatars.discourse-cdn.com/v4/letter/m/9de053/32.png) [@Mathijs.Dumon](https://mapwindow.discourse.group/u/Mathijs.Dumon)\
**Post date:** [April 2, 2021, 7:48am UTC](https://mapwindow.discourse.group/t/cant-draw-a-circle-with-radius-in-meters-anymore-in-v5-2/753/4 "2021-04-02T07:48:21Z")

</div>

This will be fixed in the next release  
(see commit [Fix for drawing spatially referenced circles: diameter was still in p… · MapWindow/MapWinGIS@607234b · GitHub](https://github.com/MapWindow/MapWinGIS/commit/607234bb45652c7c9bb6c9fc72376a4dfb5becf8))

---

<div class="post-metadata">

**Author:** ![pmeems](https://yyz2.discourse-cdn.com/free1/user_avatar/mapwindow.discourse.group/pmeems/32/9_2.png) [@pmeems](https://mapwindow.discourse.group/u/pmeems)\
**Post date:** [January 19, 2022, 12:54pm UTC](https://mapwindow.discourse.group/t/cant-draw-a-circle-with-radius-in-meters-anymore-in-v5-2/753/5 "2022-01-19T12:54:54Z")

</div>

A new release is available [Releases · MapWindow/MapWinGIS · GitHub](https://github.com/MapWindow/MapWinGIS/releases).  
I’m closing this issue.

---

<div class="post-metadata">

**Author:** ![pmeems](https://yyz2.discourse-cdn.com/free1/user_avatar/mapwindow.discourse.group/pmeems/32/9_2.png) [@pmeems](https://mapwindow.discourse.group/u/pmeems)\
**Post date:** [January 19, 2022, 12:55pm UTC](https://mapwindow.discourse.group/t/cant-draw-a-circle-with-radius-in-meters-anymore-in-v5-2/753/6 "2022-01-19T12:55:00Z")

</div>

Closed on January 19, 2022, 12:55pm UTC


