Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

scrollbar

In this step, we want to create a regular grid

to

in our model.

To do this

First, we will

need to

define the

extend

extents of the grid and the reference location (X and Y offset). These dimensions are declared in the coordinate system

a

of the model.

The first step is to

Therefore, we must define the coordinate system of the model.

For this we need the following lines of code:

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.

Code Block
languagepy
titleSet model coordinate system
firstline1
import Libraries.MapFunctions as mf

fmModel.CoordinateSystem
EPSGCode = 
mf.CreateCoordinateSystem(
3857
)
 # EPSG code for "WGS 84 / Pseudo-Mercator
In the first line we declare the MapFunctions library as the variable "mf". The next line sets the coordinate system of our model to WGS 84 / Pseudo-Mercator. To create the coordinate system we use the EPSG code (3857).  To view the
" coordinatesystem 

fmModel.CoordinateSystem = mf.CreateCoordinateSystem(EPSGCode) 

A complete list of coordinate systems and

there EPSG code visit : http://www.geotoolkit.org/modules/referencing/supported-codes.html

their respective EPSG codes can be found here.

The next step is to generate the regular grid:

Code Block
languagepy
titleGenerate regular grid
gridWidth = 200000
gridHeigth
gridHeight = 170000
xOffset = -50000
yOffset = 6400000

GenerateRegularGridForModelUsingExtend(fmModel, gridWidth, 
gridHeigth
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:

Image Added

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

 

scrollbar