I need a solution for that case:

I have got a fishnet-raster (as polygons) without any systematic order in the ID of the features and need to label every rectangle from A1 to F6:

enter image description here

For now I do it manually but I have 150 of them.

I'm looking for a way using QGIS, Python or PostGIS to automatically assign a name or a number to my grid-rectangles.

  • 1
    The answer to all "Is it possible" questions is usually "Yes." Please choose one software solution and edit your question to focus on that. "This or that" questions are effectively two questions, which violates the "One question per Question" policy. There is already an answered question on sequential labeling in PostgreSQL, but you have more information available (regular polygon alignment) so it should be pretty easy to code. You should include the exact software release and a best coding effort in your question.
    – Vince
    Commented Sep 15, 2017 at 10:29
  • Related: gis.stackexchange.com/questions/73978/…
    – Vince
    Commented Sep 15, 2017 at 10:37
  • This is a follow up to this question, no? The reason I didn't include this in the original answer was because you wanted a one to one relationship in the output table between the generated fishnet for each box and the box name, which means using a MultiPolygon for each fishnet. If you dropped that restriction, it would be easy to rewrite the fishnet code to return the x and y, or A1-F6 for each returned square within each 6x6 geom returned by fishnet. Commented Sep 15, 2017 at 11:33
  • 1
    I've written a plugin to do this already, see this answer - which also suggests an alternative for cases where the plugin isn't suitable
    – Steven Kay
    Commented Sep 15, 2017 at 12:07
  • 1
    @StevenKay, that's very nice, but it is probably easier if I fix the Postgis function from the OP's original question, seeing as it is already producing the grids that this question relates to. However, need clarification on approach. Commented Sep 15, 2017 at 15:04


Your Answer

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

Browse other questions tagged or ask your own question.