Skip to end of metadata
Go to start of metadata

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 next step is to generate the regular grid:

Generate regular grid
gridWidth = 200000
gridHeight = 170000
xOffset = -50000
yOffset = 6400000

GenerateRegularGridForModelUsingExtend(fmModel, gridWidth, gridHeight, 50, 60, xOffset, yOffset)

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".




  • No labels