• Documentation
  • Core API
  • SmartOpenHamburg API
  • Model Components API
  • Common API

    Show / Hide Table of Contents
    • MARS DSL Language
    • MARS Runtime System
      • Getting started with MARS
      • Basic Concepts
        • Multi-Agent-Simulation
        • Agents
        • Layers
        • Entities
        • Environments
          • SpatialHashEnvironment
          • GeoHashEnvironment
          • SpatialGraphEnvironment
          • CollisionEnvironment
        • Model Setup
      • Model Configuration
        • Agent and Entity Configuration
        • Layer Configuration
        • Output Filter
        • Simulation Configuration Options
        • Simulation Output Formats
      • Data Sources
        • Geospatial Data Sources
        • Geospatial Data Types
        • ASCII grid (.asc)
        • CSV
        • Time-series Data
      • Analysis and Visualization
        • Visualizing Agent Movement Trajectories
        • Simple Live Visualization
        • Analyzing Output Data
      • Tutorials
        • Creating a new MARS C# project
        • Creating a starting point for your model
        • Creating vector and raster layer files
        • Building your first model (wolf-sheep-grass)
        • Common problems and solutions
        • Acquire geo data for layers
        • Build and start your model in Kubernetes cluster
    • SmartOpenHamburg
      • Quick Start
      • Ready to use scenarios (boxes)
        • Ferry Transfer
        • Green4Bikes
        • Results
        • Result Schemas
      • Layer
        • Multimodal Layer
        • Modal Layer
        • Scheduling Layer
        • Vector Layer
      • Agents
        • Behaviour Model
        • Multimodal
        • Multi-Capable
        • Multi-Modality
        • Citizen
        • Traveler
      • Entities
        • Referencing
        • Street Vehicles
        • Bicycle Vehicles
        • Ferry

    How to prepare a vector/raster layer file

    This tutorial offers a step-by-step guide on how to create a raster layer that can be used to populate a raster layer in a MARS model.

    For more information on layers, please check out this article.


    Finding the geographic area osm_Hammerpark

    1. Open QGIS
    2. In the Browser window (center left), open the "XYZ Tiles" drop-down menu.
    3. From there, drag-and-drop OpenStreetMap into the Layer window (bottom left). This should open a world map in the main window of QGIS.
    4. On the map, navigate to where you want to obtain geodata from.


    Creating a blank layer in QGIS

    1. In the tool bar above the map, click on "Create new temporary layer" (German: "Neuen Temporärlayer anlegen").
    2. In the pop-up menu:
      1. Specify the new layer's name
      2. Select "Polygon / CurvePolygon" from the geometry type drop-down menu.
      3. Select EPSG:4326 - WGS 84
      4. Click OK
    3. Your new layer should now be visible in the Layer window


    Marking the required area on the map

    1. Click the pencil icon in the tool bar (if it is not already selected) to enter edit mode.
    2. Click the icon "Add a polygon".
    3. vector_hammerpark
    4. On the map, draw the desired shape of your raster layer. When you are finished, right-click anywhere on the map.
    5. Click the pencil icon in the tool bar and select Save in the pop-up menu.
    6. You now have your desired shape as a vector layer. If this is the desired format:
      1. Right-click the layer in the Layer window.
      2. Select "Export" and "Save object as...".
      3. Specify the file name and format. (For more information, please check out this article)
      4. Click OK
    7. You now have a vector layer file ready for use in your MARS model. For more information on how to configure layers, please check out this article.


    How to convert a vector layer to a raster layer in QGIS

    Follow these steps to convert a vector layer to a raster layer in QGIS: bad_raster_hammerpark

    1. Load your vector layer into QGIS (e.g., by dropping the layer file into the main editing window).
    2. Select the vector layer in the Layer window.
    3. Click "Raster" in the top menu bar and navigate to "Convert" and "Rasterize".
    4. Specify the vector layer as "input layer".
    5. Select "Georeferenced unit" as output (under "output raster size units").
    6. Specify Width and Height.
      1. Note: these numbers refer to longitude and latitude and are measured in degrees (°). They determine how many cells your raster layer will be divided into horizontally and vertically. Depending on the geographic dimensions (size) of your layer, you might need to select small numbers to be able to place enough cells in the layer.
    7. Under "output size", select the three dots and click "use layer dimensions".
      1. In the pop-up menu, select the vector layer you want to convert to a raster layer and click OK.
    8. perfect_raster_hammerpark
    9. Set the "Blank Value" to 1.
    10. Click "Start". Once the algorithm has finished, click "Close".
    11. Your raster layer should now be available in the Layer window (bottom left). Select the layer, then click on "Raster" in the top menu bar and select "Convert" and "Convert format".
    12. Specify the raster layer as "input layer".
    13. Under "convert", select the three dots and "Save in file...".
    14. Specify the path of your file and .asc as the file format.
    15. Click OK. You now have a raster layer file ready for use in your MARS model.

    Back to top Copyright © MARS GROUP.
    HAW Hamburg