3

I have a Shapefile that is automatically loaded in QGIS. While loading the data the coordinates x & y are automatically displayed.

In my attribute table I have lat_1, long_1 and lat_2, long_2 in the same row. How can I display both at the same time? Is there any solution for that in QGIS?

lat_1, long_1 is the main location. lat_2, long_2 is entry point location.

That means in attribute table field names should be unique right. So it will display only x and y. But in my attribute table there are entry points (lat, long) they are also coordinates. So I want the both x & y (main and entry) displayed. Added screenshot is the attribute table format

enter image description here

9
  • 3
    "how can i display both at the same time" ... what do u mean ? are they two different points to display ? – Snaileater Apr 1 at 6:43
  • 2
    Or is it a line – nmtoken Apr 1 at 7:12
  • @snaileater yes they are two different points – Bruno B Apr 1 at 9:27
  • you can use geometry generator, if its for display purposes only. – MrXsquared Apr 1 at 11:05
  • @MrXsquared can you please elaborate – Bruno B Apr 1 at 11:07
1

There are several options to do that:

  1. If one of the points is already shown on the map and you want to include the other one, you can use your attribute values to create new geometries with expressions. In the screenshot you see how the red point is created in this way, the name of the attributes can be selected on the right side by expanding Fields and values where you see the values available. The blue point is the one based on POI_X and POI_Y values: enter image description here To create two points at once, you can use this expression - however the result will be a multipoint geometry. You can convert it to single points using Menu Vector / Geometry Tools / Multipart to Single parts:

    union (
        make_point ( "X1" , "Y1"),
        make_point (  "POI_X" , "POI_Y" )
    )
    
  2. Another option is to use Create points layer from table to create an additional layer, see here for more details: https://gis.stackexchange.com/a/392917/88814 With this solution, you might use batch mode to create several points at once, but each on a separate layer: enter image description here

  3. Export your shapefile as csv (delimited text), than add it to QGIS using Data source manager with the relevant settings, see screenshot. In this case however, you can load only one point per feature. enter image description here

1
  • its working fine for me. Thanks for your quick response – Bruno B Apr 5 at 5:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.