MicroCity NotesMicroCity Notes
Notes
  • MicroCity Web
  • MicroCity Desktop

    • 1. MicroCity Introduction
    • 2. Getting Started with MicroCity
    • 3. User Interface
    • 4. Script Writing
  • GitHub

    • MicroCity Desktop Repository
    • MicroCity Web Repository
    • MicroCity Web Online Environment
  • 简体中文
  • English
Notes
  • MicroCity Web
  • MicroCity Desktop

    • 1. MicroCity Introduction
    • 2. Getting Started with MicroCity
    • 3. User Interface
    • 4. Script Writing
  • GitHub

    • MicroCity Desktop Repository
    • MicroCity Web Repository
    • MicroCity Web Online Environment
  • 简体中文
  • English
  • MicroCity Documentation

    • Table of Contents
    • 1. MicroCity Introduction

      • 1.1 What MicroCity can Do
    • 2. Getting Started with MicroCity

      • 2.1 Showing a World Map
      • 2.2 Searching for Countries
    • 3. User Interface

      • 3.1 UI Overview
      • 3.2 Vector Shapes
      • 3.3 Raster Grids
      • 3.4 3D Scenes
      • 3.5 Tables
      • 3.6 Maps and Layers
      • 3.7 Modules
    • 4. Script Writing

      • 4.1 SI Overview
      • 4.2 UI Control
      • 4.3 Shapes and Tables
      • 4.4 Grids
      • 4.5 3D Scenes
      • 4.6 Networks
      • 4.7 Discrete Event Simulations
      • 4.8 Mixed Integer Programming

4.4 Grids

Grids in MicroCity have simple structure (3.3) but efficient time and space utilization if applying algorithms on them. Sample codes for this chapter can be found in the "grid_samples" folder of the Project Tab in iconScriptEditor.

Cellular Data Manipulation

CreateGrid ("name", "Int|Float|Double", XMax, YMax [, CellSize = 1 [, xMin = 0 [, yMin = 0] [, init = 0]]]])

Returns a Grid object.

GetCellSize (Grid)

Returns the Cellsize value of a Grid.

GetGridMaxXY (Grid)

Returns XMax, YMax of a Grid.

ConvertToGridXY (Grid, x1, y1 [, x2, y2, ...])

Converts real coordinates to coordinates in a Grid. Returns X1, Y1, X2, Y2, ... .

ShapeToGrid (Grid, Shape, value)

Rasterizes a Shape in a Grid. The cell values will be set according to the covering area and the inputed value.

ShapeToGrid (Grid, Shapes, "field_name")

Rasterizes all Shape objects in a Shapes. The cell values will be set according to the covering area and the values of Shapes field.

GetValue (Grid, X1, Y1 [, X2, Y2, ...])

Returns cells' (specified by Grid coordinates) values: value1, value2, ... .

SetValue (Grid, value, X1, Y1 [, X2, Y2, ...])

Sets values for cells specified by Grid coordinates.

GetCenterXY (Grid)

Returns the center real coordinate (x, y) of a Grid.

GetCenterXY (Grid, X1, Y1 [, X2, Y2, ...])

Returns the real coordinates of cells' centers: x1, y1, x2, y2, ... .

GetExtent (Grid)

Returns the leftbottom and righttop corner of a Grid's extent: Lx, By, Rx, Ty.

GetExtent (Grid, X, Y)

Returns the leftbottom and righttop corner of a cell's extent: Lx, By, Rx, Ty.

GetFractalDim (Grid, X1, Y1, X2, Y2, fold [, MultiFractalQ = 0])

Calculates fractal dimension of the specified area in a Grid. Returns dimension, RSQ of linear regression, and the number of boxes in every fold.

Last Updated:
Contributors: huuhghhgyg
Prev
4.3 Shapes and Tables
Next
4.5 3D Scenes