0

I currently have an EPSG:4326 - WGS 84 MultiPolygon shape in QGIS.

Shapefile of lake

I need to make a path planning tool to cross the lake above. In which case I need to convert this shapefile into a raster (from which I can make black and white 1 - lake, 0 - not lake), but I also need the lat / lon coordinates of each pixel, so that I can set the waypoints that the path planner finds.

How can I generate three arrays:

  1. Boolean 1/0 for each pixel deciding whether it is water or not.
  2. Matrix containing the latitudes of each pixel.
  3. Matrix containing the longitudes of each pixel.
3
  • 1
    Coordinate x,y is implicit in a 2D raster. The seems like an XY Problem, since your question doesn't seem to get you closer to solving the goal.
    – Vince
    Commented Nov 4, 2021 at 3:27
  • If you are familiar with GDAL/OGR, try the gdal_rasterize program. I do not have a working code to share but have tested it in command line. You can create a GeoTIFF file and save lat/lon from GeoTIFF in separate files if you need. The description is available here: [gdal.org/programs/gdal_rasterize.html][1] Alternatively, if you are already using QGIS, it has GDAL/OGR included in it - so you need to figure out how you can use gdal_rasterize from QGIS. Or, use Python, import GDAL/OGR and use the gdal_rasterize module. [1]: gdal.org/programs/gdal_rasterize.html
    – PDash
    Commented Nov 4, 2021 at 5:39
  • Rasterize it, read the raster into numpy array, calculate lat and longs
    – Bera
    Commented Nov 4, 2021 at 6:37

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.