NOTICE: help.openstreetmap.org is no longer in use from 1st March 2024. Please use the OpenStreetMap Community Forum

How can I detect round objects with JOSM? If necessary I would even write my own plugin.

Let's say that round buildings normally have > 15 edges, but other buildings can have this too. Is there any trick how to detect buildings with many identical angles near 180 °?

asked 03 Aug '18, 22:12

Druzhba's gravatar image

Druzhba
150111118
accept rate: 0%

This seems interesting.

+1

(04 Aug '18, 23:06) norcross

Maybe this ticket is related: https://josm.openstreetmap.de/ticket/16283

(04 May '19, 11:11) qeef

Maybe this ticket is related: https://josm.openstreetmap.de/ticket/16283

permanent link

answered 04 May '19, 11:10

qeef's gravatar image

qeef
451
accept rate: 0%

One neat fact about circles is that they have the smallest possible perimeter (circumference) for their area of any shape. The area of a circle = (perimeter ^ 2) / (4 * pi). So if you find the area and perimeter of a given shape, you can calculate the following ratio: (perimeter ^ 2) / (4 * area). For a circle, this ratio will be pi. For a square, it will be 4. For approximate circles like those in OSM, it will be somewhere between. The more circular the shape, the closer to pi.

If you do write a plugin, you could configure it for a range, say between pi and 3.25, and find shapes within that range.

...However, calculating the area of a shape defined by an arbitrary set of node coordinates can be a little complex, so if you don't have a built in routine for this calculation you might want to do something simpler. You could find the maximum distance between any two points in the shape and compare that to the perimeter. For a circle, this maximum distance will be the diameter, and the ratio of the perimeter to the diameter should be pi. For nearly-circular shapes, this ratio will be a little less than pi. (For a square it will be 2 * sqrt(2), about 2.83.)

Note that, depending on the range of ratio values you decide to consider circular, these techniques will not necessarily restrict your answers to "factory" circles with a lot of identical angles. IMO this is probably a good thing -- there are probably many circular ways that are drawn by hand or otherwise slightly deformed.

permanent link

answered 05 May '19, 20:29

jmapb's gravatar image

jmapb
3.4k73361
accept rate: 22%

Not sure I have understood your question. Do you mean draw a true circular shape? Not used JOSM much but thought it must have a tool for it. I searched and found this https://learnosm.org/en/josm/josm-tools/

permanent link

answered 05 May '19, 23:50

andy%20mackey's gravatar image

andy mackey
13.2k87143285
accept rate: 4%

edited 05 May '19, 23:55

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×622
×252
×5

question asked: 03 Aug '18, 22:12

question was seen: 2,432 times

last updated: 05 May '19, 23:55

NOTICE: help.openstreetmap.org is no longer in use from 1st March 2024. Please use the OpenStreetMap Community Forum