3

I am working with ENC files from noaa, specifically S57 format or ".000" to be as specific as possible.

I am trying to render a layer or even the entire thing in a window but have had no luck. Perhaps you could tell me where I am going wrong.

I am pretty sure the error is happening here:

layer = QgsVectorLayer(filename, "DEPARE", "ogr")

I get the error:

ERROR 4: S57 Driver doesn't support update.

Code:

from qgis.core import *
from qgis.gui import *
from PyQt4.QtCore import *
from PyQt4 import QtGui

app = QtGui.QApplication([])

QgsApplication.setPrefixPath("C:/OsGeo4w/apps/qgis", True)
QgsApplication.initQgis()

window = QtGui.QMainWindow()
window_frame = QtGui.QFrame(window)
window.setCentralWidget(window_frame)
frame_layout = QtGui.QGridLayout(window_frame)

canvas = QgsMapCanvas()
frame_layout.addWidget(canvas)

filename = "C:/Users/jacot/Desktop/ENC_ROOT/US1AK90M/US1AK90M.000"
layer = QgsVectorLayer(filename, "DEPARE", "ogr")

if not layer.isValid():
  print "Layer failed to load!"

QgsMapLayerRegistry.instance().addMapLayer(layer)
canvas_layer = QgsMapCanvasLayer(layer)
canvas.setLayerSet([canvas_layer])
canvas.zoomToFullExtent()

window.show()
app.exec_()

Ultimately I want to save this in a raster format like .tif or .png. Maybe it would be easier to do that first? Could you assist me or point me towards documentation for this as well?

  • Are you able to add the layer manually to the map? – artwork21 May 9 '16 at 17:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.