You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 9 Next »

In this step we want to create a regular grid to our model. To do this we will need to define the extend of the grid and the reference location (X and Y offset). These dimensions are declared in the coordinate system a the model.

The first step is to define the coordinate system of the model. For this we need the following lines of code:

Set model coordinate system
import Libraries.MapFunctions as mf

EPSGCode = 3857 # EPSG code for "WGS 84 / Pseudo-Mercator" coordinatesystem 

fmModel.CoordinateSystem = mf.CreateCoordinateSystem(EPSGCode) 

In the first line we declare the MapFunctions library as the variable "mf". The next 2 lines set 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 list of coordinate systems and there EPSG code visit : EPSG codes


The next step is to generate the regular grid using the following lines :

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

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

The first four statements define the dimensions and offset of the grid. The last statement actually creates the grid and adds it to the model. The 50 and 60 in the last statement stands for the number of cells in horizontal and vertical direction.

 

With the provided dimensions and offset you should get a regular grid between the British and French coast looking like this :

 

This can be seen by double clicking the "Water Flow FM Model" in the project toolwindow. To add the background layer go to the map toolwindow and click the button "Add new WMS layer ..." and choose the "Bing Maps - Hybrid" option.

 

 

 

  • No labels