span8
span4
span8
span4
Previous: Convert from Raster to Vector
在本教程中,您将学习如何将vector polygon features into raster data using theMapnikRasterizer, although this method also works for other geometries (such as point and lines). For a more detailed introduction on how to use the MapnikRasterizer transformer, see theIntroduction to MapnikRasterizerarticle.
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.或者,您可以下载提供的文件(s) and replace the PostGIS reader with a reader of the appropriate format.
In this scenario, you want to create a raster map classified with land and park areas. Using Neighborhood and Park polygon features from the PostGIS training database, you will create a raster dataset with areas classified by RGB values (green for parks and black for urban).
The MapnikRasterizer allows you to convert point, line, and polygon features onto a new raster by dividing features into groups called layers. For more information see theMapnikRasterizer Documentation.
Notice the two connections are listed in the Rendering Rules; however, they are set as Line symbols.
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.
Next, you will classify the park cells. Similar to classifying urban cells, modify the Polygon Parameters by clicking Edit in the Parks row.
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.
This will effectively remove the background cells by making them transparent since you are only interested in creating raster cells for areas that are either urban or park in this exercise. For more information see theSetting NoData and Adding Alpha Bands to Remove Black Bordersarticle.
如果你得到意想不到的结果,你可能需要d to reset the PostGIS table(s) that you read in. For more information see theResetting the PostGIS Training Databasearticle.
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