JOSM: How can I select the entire geometry of a GeoJSON Feature

Hi guys!

I have a simple GeoJSON file as below (it represents a simple rectangle):


{
    "type": "FeatureCollection",
    "features": [
        {
            "type": "Feature",
            "geometry": {
                "type": "MultiLineString",
                "coordinates": [
                    [[24.081728100515615,56.907953930904874],[24.081728100515615,56.908400069095116]],
                    [[24.082185899484383,56.907953930904874],[24.082185899484383,56.908400069095116]],
                    [[24.081728100515615,56.907953930904874],[24.082185899484383,56.907953930904874]],
                    [[24.081728100515615,56.908400069095116],[24.082185899484383,56.908400069095116]]
                ]
            }
        }
    ]
}

After loading it in JOSM I couldn’t find a simple way to select the entire geometry of that feature. With simple mouse clicks I can select only individual segments. I’m interested in selecting a complex geometry with a simple key combination and eventually a few mouse clicks. Is this possible?

If using a Polygon in the above example instead of a MultiLineString, a simple click on one of the segments will select the entire geometry. I suspect JOSM cannot handle Multi* geometries.

NOTE: Selecting a rectangular region with the mouse is not an option in my case. I have a big GeoJSON file with multiple features described by complex geometries, so I cannot easily identify the elements of a particular feature. I want to select just one element/segment and see also the others that describe the same feature.

Thanks!

Have you tried Ctrl + click, this will select as many objects as you want.

Thanks @BCNorwich. This seems suboptimal since each segment/object should be selected. A typical feature can contain up to 10-20 such objects, and the entire file contains a few 1000s of such features. Also as mentioned in the NOTE part, in some cases it is not obvious if two objects are part of the same feature (in order to be selected together). Ideally, I’d like to select one object and see the related ones as well (i.e. see the entire feature).

Installing https://josm.openstreetmap.de/wiki/Help/Plugin/UtilsPlugin2 in JOSM you can use Ctrl+Shift+E to select connected ways of a selected object.

Thanks for suggestion @PHerison! That will help to a certain extent, but the objects of a particular feature may not be connected.

From what I’ve seen so far, it seems JOSM can tackle only one shape/perimeter (connex component) at a time. For example even if a geometry is of Polygon type, but containing holes, it seems impossible to select all perimeters at once without picking them individually.

You can try to use JOSM’s search-capabilities to get the desired result selected. Hover with the mouse over the search-button to get some help or consult the wiki for more information about search-parameters in JOSM.

Yes, the search could be a workaround. Especially if you can make sure that each geometry has some unique attribute that can then be used to search for it. (You can then right-click on the tag and use “Search Key/Value/Type”.)

Seeing how JOSM is an OSM editor first and foremost, and the OSM data model doesn’t have Multi* geometries, I expect that JOSM converts those into multiple regular geometries when importing GeoJSON.

For a Polygon with holes, JOSM might create a multipolygon relation. If that’s the case, you should have the option of selecting all members of the relation.

Thanks guys! I’ll have a look at the search feature.

For sure there are multi geometries within OSM and JOSM supports them. These are relations. There is even a proposal for multilinestring relations.

Once you have relations, it is no problem to select all members as there is an item for that in some panel context menu like relation and selection panel.