In this step, we want to create a regular grid in our model. First, we will define the extents of the grid and the reference location (X and Y offset). These dimensions are declared in the coordinate system of the model. Therefore, we must define the coordinate system of the model.
First, we import the MapFunctions library, using the alias mf for future reference. Next, we set the coordinate system of our model to WGS 84 / Pseudo-Mercator. To create the coordinate system, we use the corresponding EPSG code, 3857.
Set model coordinate system
import Libraries.MapFunctions as mf
EPSGCode = 3857 # EPSG code for "WGS 84 / Pseudo-Mercator" coordinatesystem
fmModel.CoordinateSystem = mf.CreateCoordinateSystem(EPSGCode)
A complete list of coordinate systems and their respective EPSG codes can be found here.
The first four statements define the dimensions and offset of the grid. The last statement creates the grid and adds it to the model. The parameters 50 and 60 in this last line of code indicate the number of cells in the horizontal and vertical directions of the grid, respectively.
With the provided dimensions and offset, the following regular grid between the British and French coast should be obtained:
This map view can be opened by double clicking the "Water Flow FM Model" in the project panel. The background layer shown above is added by clicking the button "Add new WMS layer ..." of the map panel, and then selecting "Bing Maps - Hybrid".