TransWikia.com

Creating polygon using coordinates

Geographic Information Systems Asked on July 5, 2021

I am using QGIS 3.2 and I need to create an area to form a polygon shapefile using latitude and longitude, not using Python as I am just a beginner. How to do this?

3 Answers

To give an example according to @geom recommendation. You must use the syntax to define polygons in WKT format, here an example in CSV:

enter image description here

Finally use add delimited text data source:

enter image description here

With the following result:

enter image description here

To edit the question to provide an example of where I need to create a polygon via distances.

I need to create a polygon to represent a survey area. The survey area required is 3.58km x 3.0km. I have used the v.buffer GRASS tool and the Buffer tool. Which I select a certain point to buffer Around to create the survey area. However I cant find any input within these tools where I can enter such distances. Do you know how to fix this?

Answered by SamTux on July 5, 2021

An addition to the answer above: I found it pretty complicated to write the WKT using the boundary coordinates myself. If you have Postgres with Postgis extension (and possibly pgadmin) available (use the Docker version!), just execute the following:

SELECT ST_AsEWKT(ST_MakeEnvelope (
    12.147653576, 50.978794549, --lng-lat bounding 
    13.216635542, 51.684973715, --lng-lat box limits (Example)
    4326))

You will get back the eWKT formatted string:

SRID=4326;POLYGON((12.147653576 50.978794549,12.147653576 51.684973715,13.216635542 51.684973715,13.216635542 50.978794549,12.147653576 50.978794549))

This can be loaded using the answer above in QGIS with import CSV or using the "QuickWKT" plugin

For anyone who still wants to do this manually, here's the format for 2-coordinate bbox-polygon:

POLYGON((
left-lng bottom-lat,
left-lng top-lat,
right-lng top-lat,
right-lng bottom-lat,
left-lng bottom-lat))

Answered by Alex on July 5, 2021

Use geojson. Just create a valid .geojson file with contents such as:

{"coordinates": [[[31, -5],
                  [32, -5],
                  [32, -4],
                  [31, -4],
                  [31, -5]]],
 "type": "Polygon"}

You can use a tool like geojsonlint to make sure the syntax is correct. Once you have a valid geojson, save it to a file, e.g my_polygon.geojson. Then, just drag and drop it to your "Layers" in QGIS. That's it.

enter image description here

In my opinion, this is much easier than the methods mentioned in other answers.

Answered by Jan Pisl on July 5, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP