{"id":23061826,"url":"https://github.com/rrwen/qgis-rasterarray","last_synced_at":"2025-08-15T08:33:03.893Z","repository":{"id":27709125,"uuid":"31196055","full_name":"rrwen/qgis-rasterarray","owner":"rrwen","description":"Raster data example in QGIS using numpy arrays","archived":false,"fork":false,"pushed_at":"2024-01-19T08:15:26.000Z","size":33,"stargazers_count":4,"open_issues_count":0,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-01-19T10:05:23.865Z","etag":null,"topics":["cell","console","conway","data","gameoflife","gdal","geographic","geolocation","gis","numpy","qgis","raster"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rrwen.png","metadata":{"files":{"readme":"Readme.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-02-23T06:01:31.000Z","updated_at":"2024-01-19T08:15:30.000Z","dependencies_parsed_at":"2022-09-14T17:53:36.063Z","dependency_job_id":null,"html_url":"https://github.com/rrwen/qgis-rasterarray","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rrwen%2Fqgis-rasterarray","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rrwen%2Fqgis-rasterarray/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rrwen%2Fqgis-rasterarray/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rrwen%2Fqgis-rasterarray/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rrwen","download_url":"https://codeload.github.com/rrwen/qgis-rasterarray/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":229901955,"owners_count":18141802,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cell","console","conway","data","gameoflife","gdal","geographic","geolocation","gis","numpy","qgis","raster"],"created_at":"2024-12-16T03:18:35.448Z","updated_at":"2024-12-16T03:18:36.073Z","avatar_url":"https://github.com/rrwen.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":" \n# Quantum GIS Raster Array Module \n\nA Python module for manipulating geographic raster image data in QGIS using numpy arrays. Includes a demonstration for Conway's Game of Life.  \n\n* **View the [Game of Life Blog Post](https://gis.blog.torontomu.ca/2015/03/08/a-raster-based-game-of-life-using-python-in-qgis/)**\n* **View [Example.txt](Example.txt) for an example run.** \n \n_Dependencies: QGIS 2.6.1 Brighton, Python 2.7_ \n \n \n#  QGIS Python Console Setup\n  \n  \n 1. Go to the python command console in QGIS  \n   `(Plugins \u003e Python Console)`\n  \n 2. Enter in the console:  \n    `import sys`\n  \n 3. Find the location path of this script  \n    `C:\\\\User\\\\Desktop`\n  \n 4. Append it to the QGIS system paths with:  \n       `sys.path.append(FILE_PATH_HERE)`   \n       `sys.path.append (\"C:\\\\User\\\\Desktop\")`\n      \n 5.  Import the Cells class for use in the console:  \n    `from RasterArray import *`\n  \n  \n# Cells\n  \n  \n##  A. Creating the Cells Object  \n  \n * Create a Cells object as a random array:\n   \n    `cellsObject = Cells()`\n  \n * Create a Cells object as a filled array:\n   \n    `cellsObject = Cells(inRaster=n)`  \n    + n is the value to fill the array with\n  \n * Create a Cells object as a custom array:\n   \n    `cellsObject = Cells(inRaster=[(r1c1,r1c2,r1c3),(r2c1,r2c2,r2c3)])`  \n    + r1c1..rncn refers to row 1 (r1) and column 1(c1) to row n (rn) and column n (cn)  \n    + The containers [] define a list and () define a tuple\n  \n * Create a Cells object with a raster file:\n \n    `cellsObject = Cells (\"path_to_raster_file\")`  \n    + \"path_to_raster_file\" is the location of the raster with\n      extension\n  \n##  B. Modifying and Obtaining Cell Values  \n   \n * Modify a cell value:\n   \n    `cellsObject.modify(x, y, value)`  \n    + x and y are the coordinates of the cell to modify  \n    + value is the value to replace the cell value at the location  \n    + for non-geographic coordinates, use (x, y, value, geographic=False)\n  \n * Obtain a cell value:\n \n    `cellsObject.get(x, y)`  \n    + x and y are coordinates of the cell to obtain  \n    + for non-geographic coordinates, use (x, y, value, geographic=False)\n  \n##  C. Output to Raster TIF  \n  \n * Output a raster representing the changes:\n \n    `cellsObject.toRaster(\"path_to_output_raster_file\")`  \n    + \"path_to_output_raster_file\" is the location of the output\n      raster file with extension\n  \n##  D. Additional Settings  \n  \n * Set the band of the raster\n   \n    `cellsObject = Cells (nband=n)`  \n    + n is band number of the input raster, does not work for default\n  \n * Set the spatial reference system of the randomly generated raster\n   \n    `cellsObject = Cells (EPSG=coorSys)`  \n    + coorSys is the EPSG number of the spatial reference of the randomly generated raster\n  \n * Setting the dimensions and cell measurements of the randomly generated raster\n   \n    `cellsObject = Cells (cols=c,rows=r,pixelWidth=w,pixelHeight)`  \n    + c and r are inputs in whole numbers to specify the number of columns and rows  \n    + w and h are inputs in real numbers to specify the width and height of cells\n  \n  \n# GameofLife\n  \n  \n##  A. Creating a GameofLife Object  \n  \n * Create a GameofLife object:  \n\n    `GoLObject = GameofLife()`\n  \n##  B. Cycling the Game Board  \n  \n * Cycle the game n times:  \n\n    `GoLObject.cycle(n)`  \n    + n is the number of times to cycle the gaming board\n  \n * Reset the game:\n\n    `x.reset()`  \n    + reset the gaming board to the initial state\n  \n##  C. Additional Settings  \n  \n### C1. Data  \n  \n * Set the initial board when creating the GameofLife object:\n   \n    `GoLObject = GameofLife(raster=\"path_to_raster_file\")`  \n    + \"path_to_raster_file\" is the path to the raster file with extension to be used for the initial board\n  \n * Set whether or not to overwrite cycles:\n\n    `GoLObject.overwrite = boolean`  \n    + boolean is set to True or False, where True overwrites each cycle, and False does not overwrite each cycle\n  \n * Set the spatial reference system of the randomly generated raster\n   \n    `GoLObject = GameofLife(EPSG=coorSys)`  \n    + coorSys is the EPSG number of the spatial reference of the randomly generated raster\n  \n### C2. Aesthetics  \n  \n * Set the style of the start and cycle boards with a qml file:\n\n    `GoLObject.qmlStyle = \"path_to_qml_file\"`  \n    + \"path_to_qml_file\" is the path to the QGIS .qml style file used for changing the style of the output board\n  \n * Set the refresh speed:\n\n    `GoLObject.speed = x`  \n    + x is the refresh speed in seconds before processing the next cycle\n  \n### C3. Dimensions  \n  \n * Set the width and height when creating the GameofLife object:\n   \n    `GoLObject = GameofLife(width=w, height=h)`  \n    + w and h are inputs in whole numbers to specify the width and height of the randomly generated board\n  \n* Set the raster cell sizes when creating the GameofLife object:\n\n    `GoLObject = GameofLife(cellWidth=w, cellHeight=h)`  \n    + w and h are inputs in real numbers to specify the width and height of cells in the randomly generated board\n  \n  \n#  Authors\n  \n  \n* Richard Wen (rwen@ryerson.ca)\n* Dr. Claus Rinner (crinner@ryerson.ca)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frrwen%2Fqgis-rasterarray","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frrwen%2Fqgis-rasterarray","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frrwen%2Fqgis-rasterarray/lists"}