0

I need to create a large number of polygons (say 1000) on a georeferenced mosaic (from aerial photographies). I know polygons' height and width, and I know the spacing between them. I can also provide the edges of the containing polygon.

Let's say,I want to create 1mts x 3mts polygons with a 0.5 mts (both vertical and horizontal spacing) in the area delimited by the rectangle defined by points (p1, p2, p3, p4).

Does anyone know about a tool to do this automatically? Or any recommendation on its implementation?

2
  • Which software are you using?
    – Mapperz
    Commented Dec 2, 2014 at 15:27
  • I am currently using arcmap and also trying out qgis. Also have a webapp in python with geodjango and postgis if the only way is to develop a custom solution. Commented Dec 2, 2014 at 19:00

2 Answers 2

1

If you're not familiar with Python programming, but know how to use Excel, you can create a spreadsheet that has the polygon corners in WKT format, save the spreadsheet as a .csv file, the open in QGIS. Using WKT format in a csv file is a handy trick I've picked up from other answers here. It allows you to convert all sorts of data into something QGIS can handle without needing to know anything beyond basic Excel functionality.

Let's say you want 4 rows, 5 columns of rectangles, .25 degrees tall, with .1 degrees between rows. Cols are .3 degrees wide, with .05 degrees between. The origin of the grid is at 10° latitude, -106° longitude Create a spreadsheet with the following first two rows: enter image description here

The last column should have WKT in the header cell, and creates the WKT and looks like this (very ugly)

=CONCATENATE("polygon((", F2," ",  D2, ", ", F2," ", E2, ",", G2," ", E2," ,", G2, " ", D2,",", F2, " ", D2, "))")

Since we want 20 polygons, fill col A with 1 through 20 and copy columns B through H alongside those entries.

Save this spreadsheet as a .csv file.

Now open QGIS and select Layer->Add Delimited Text Layer and browse to the csv file you just created. Set Geometry Definition to WKT, Geometry Type = Detect, Geometry field to WKT (or whatever you have in cell H1).

Then click OK

To generalize, replace "5" in the various formulas with however many columns you want. Replace ".25" with the row height in appropriate units, "-0.3) with col width, "0.1" with inter-row spacing, "-0.05" with inter-column spacing, "10" with Y (latitude) origin, "-106" with X (longitude) origin.

If you're not working in degrees, you will have to set the CRS for your new layer to match the CRS you are using. Depending on your preferences, you may be prompted for the CRS when you click OK to create the layer.

1

You can do without using programming with the use of "Create Fishnet" tool in the Arc toolbox and "buffer" tool in editor toolbar. After creating fishnet polygons you have to buffer the polygons with the spacing as negative value in the create buffer window. This will create polygon with spacing and you can delete the old polygons. Try this one. it works for me.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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