# It would be nice for yEd to have a geographical layout.

In real networks the node's property is its model coordinates (x, y). It would be nice for yEd to have a geographical layout.

Seems, that this is not difficult to do – the canvas is a system of own coordinates and necessary to approve it with system of my coordinates, similarly with system of coordinates of screen of monitor

retagged
Instructions of Raindrops in his answer does not work – my city’s coordinates (in Data) not affected on the coordinates of the graph nodes (in General)
Sorry, dear Raindrops, You were right. Thinks

Did you mean Latlong coordinates? IINW a "Geographical" layout would require yEd to possess a internal database of places around the world with their latlong coordinates, so that when you enter a name of a place, it would place its node correctly on the canvas (as if on a map).

Coordinates are defined with an accuracy of 4 digits. For example, the Ulsoor Lake in Bangalore is at 12.9817° N, 77.6286° E. So if you use their raw form to place the nodes, many nodes will overlap. Therefore you will have to use some scale factor to space apart the nodes.

Following is the procedure to place the nodes on an imaginary map of the world (all you need is to use a world map as background):

We will assume that you already have an excel sheet with three columns:

1. Latitude of the place

2. Longitude of the place

3. name of the place.

Stage-1: Use the custom properties

1. Use the menu: Edit > Manage custom properties

2. In the dialog that pops up, go to Node properties section (at the top).

3. Click on the green + button.

4. In the Name column, double-click and Select the text Property 1. Enter X

5. In the Type column, use the drop down menu to select "Decimal".

6. Leave the value to 0 (default).

Steps 3-6 add an X dimension to the diagram (file).

Repeat the steps 3-6 to add the Y dimension also.

So far we have added two custom properties to the diagram (file). But at present, it means nothing to yEd. We will give it a meaning to it in the next section.

Stage-2: Place copies of a node at the required coordinates

Go through different palettes and find a node shape that pou want to place at the given coordinates.

Now you have to place its copies at the coordinates given in the Excel file.

This is where you tell yEd that the X property means the current node’s x-coordinate, and the Y property means the current node’s y-coordinate. For this, use Property mapper.

1. Click on the green + button in the Configurations section.

Yed editor offers you two options:

1. New configuration for nodes

2. New configuration for edges.

Choose the first option.

2. In the Name field, enter a new name (say “NodeCoordinates”)

3. In the Template field, select “Single” (middle option) and then press on the ? Button. The browse to the desired node. Immediately this node will appear in the Template view pane.

At the same time, a dummy entry appears in the table below. It says-

Data source: Not applicable

Map source: Template

Leave the “Conversion” unchanged.

4. Now in the Mappings table, click on the green + button.

5. yEd looks for available variables and picks “X”.

6. Now select the Map to and select x axis.

7. Repeat steps 6 and 7 for variable Y.

8. To save this configuration as a separate file, click on the button.
This saves the configuration as a new file: NodeCoordinates.cnfx

9. click on the OK button to finish.

Stage-3: Crate copies of a node using an excel sheet of places

Now we ask yEd Editor to read the Excel sheet, and place one copy of the template node at the desired coordinates.

1. Select the menu File > Open

2. Select the Excel file that has the latlong coordinates of the places.

3. A dialog pops up. Ignore the Edge list section at top, and go to the Node list section at bottom half.

4. Define the Data range (all three columns),

5. Define the Node ID column (the column that lists the names of the places)

6. Switch to the second (Presentation) tab.

7. Select “use configuration” check box.

8. Select the configuration saved earlier (say, NodeCoordinates”).

9. Select the Layout using the drop-down list (typically, Hierarchical works in most cases.)

10. Click on OK.

by (1.5k points)
edited