span8
span4
span8
span4
Previous: Modify Raster Cell Size by Resampling
In this tutorial,you will learn how to select an area and change the values of raster cells by overlaying a polygon onto a raster dataset.This can be easily accomplished in FME using theMapnikRasterizer,an existing raster dataset,and point,line,or polygon features.
changing-raster-values-by-geographic-feature.fmwt
Note: Since you areworking on a public facing database,tables can occasionally be overwritten and/or modified.If your translation produces unexpected results,see theResetting the PostGIS Training Databasearticle.Alternatively,you can download the provided file(s) and replace the PostGIS reader with a reader of the appropriate format.
In this scenario,you will reclassify raster cells based on areas where park polygons overlay urban cells.This will change the band values from [Band 0: 0],[Band 1: 0],[Band 2: 0],[Band 3: 255] to [Band 0: 0],[Band 1: 255],[Band 2: 0],[Band 3: 255] where park polygons overlay raster cells in the VancouverLand dataset.
The MapnikRasterizer allows you to convert point,line,and/ polygon features onto a new or existing raster by dividing features into groups called layers.For more information see theMapnikRasterizer Documentation.
Notice how the two connections are listed in the Rendering Rules;however,they are set as Line symbols.Since you are classifying raster values by park polygons,you need to change the symbolizers for both of the Rendering Rules.
Important: ensure the rendering rules are ordered as they are in the screenshot above otherwise the urban cells will be created on top of the park cells.The urban cells need to be classified first,followed by the park cells so they appear on the output raster.You can adjust the ordering of the rendering rules using the move up/down arrows below the Rendering Rules box.
Smoothing is used to control whether the output will have to follow Boolean or Fuzzy logic.A Smoothing Gamma value of 1 uses Fuzzy logic which is useful for areas with movement or uncertainty such as a shoreline.Alternatively,a Smoothing Gamma value of 0 uses Boolean logic which is useful when you want to classify cells with 100% certainty.This exercise will use Boolean Logic so cells will be classified as either urban or park - this will prevent cells from being classified as 20% park and 80% urban.
Fuzzy Logic
Boolean Logic
The Cell Spacing parameter specifies the width of the output raster cells,measured in ground units.Note: smaller cells provide greater resolution,however,they typically take longer to load when viewing large extents (i.e.a cell spacing of 1 will take longer to load than 5) and also have large file sizes.
An Automatic Attribute Definition is when Workbench automatically defines the list of attributes,depending on which Reader feature types are connected,for more information see theAbout Writer Feature Types: User Attributesdocumentation.
After running the translation,the output will be displayed in the FME Data Inspector.Notice the park cells have been classified using the Raster Bands (Band 0-3) and urban areas are black.
Data used in this tutorial originates from open data made available by theCity of Vancouver,British Columbia.It contains information licensed under the Open Government License - Vancouver.
© 2019 亚搏在线Safe Software Inc |Legal