[QGIS-Developer] PYQGIS - OpenGL in QgsPluginLayer
Eric Younkin - NOAA Federal
eric.g.younkin at noaa.gov
Thu Mar 4 11:56:52 PST 2021
This is great, thanks for the info. I believe we will be working through
the GUI to do the symbolization.
Thanks,
Eric
On Thu, Mar 4, 2021 at 8:50 AM Martin Dobias <wonder.sk at gmail.com> wrote:
> Hi Eric
>
> I don't know about the S57 driver, best to ask on the gdal mailing list
> about that...
>
> As for QML format... you should not try to read/write raw XML data of QML
> files: although that happens rarely, the format may change between versions
> of QGIS as the schema is not guaranteed to be stable and it should be
> considered as an implementation detail of QGIS. To prepare QML files, the
> two preferred ways are:
> 1. GUI - use QGIS app to set up styling of the map layer
> 2. Python API - use PyQGIS library to create renderer (e.g.
> QgsSingleSymbolRenderer) and symbol (e.g. QgsMarkerSymbol) objects and
> assign them to a map layer
> Then to save the QML file, you can again either use GUI (layer properties
> dialog) or use Python API (QgsMapLayer.saveNamedStyle(...))
>
> Regards
> Martin
>
>
> On Wed, Mar 3, 2021 at 7:02 PM Eric Younkin - NOAA Federal <
> eric.g.younkin at noaa.gov> wrote:
>
>> All,
>>
>> This is very useful, thanks. The S57 driver does appear to give the
>> layers by names that I recognize:
>>
>> INFO: Open of `C:\collab\dasktest\data_dir\13238_FFF.000'
>> using driver `S57' successful.
>> 1: DSID (None)
>> 2: LNDARE
>> 3: LNDELV
>> 4: SBDARE
>> 5: UWTROC (Point)
>>
>> I've found the QML format spec here
>> <https://docs.qgis.org/3.16/en/docs/user_manual/appendices/qgis_file_formats.html>,
>> but is there any guidance on starting from scratch? Thanks again for all
>> the help.
>>
>> Eric
>>
>>
>> On Wed, Mar 3, 2021 at 12:38 PM Martin Dobias <wonder.sk at gmail.com>
>> wrote:
>>
>>> Hi Eric
>>>
>>> On Wed, Mar 3, 2021 at 5:48 PM Eric Younkin - NOAA Federal <
>>> eric.g.younkin at noaa.gov> wrote:
>>>
>>>> Thanks for the quick reply. This is for NOAA nautical chart symbology,
>>>> following the s57/s52 spec. You can see the symbology in the online viewer
>>>> here <https://www.nauticalcharts.noaa.gov/ENCOnline/enconline.html>.
>>>> It is basically a very complex spec that we generated for display in a
>>>> wxPython widget a long time ago using GDAL 1.x commands. S57 is already an
>>>> existing OGR driver, although I do not know what exactly that driver does.
>>>> I do know that it does not somehow generate the symbology of the data for
>>>> you to then render.
>>>>
>>>> The vector data would be a combination of area/line/point features, and
>>>> I don't think it would be a fit for the Mesh layer.
>>>>
>>>> We'd like to make this symbology available in QGIS, so that users can
>>>> drag in a s57 file and view the chart. You can use one of our WMS
>>>> services, but having the file support would be useful. Ideally in a plugin
>>>> layer, so that I can also use it in our other apps that use PYQGIS QgsMapCanvas
>>>> widgets.
>>>>
>>>
>>> Thanks for more background. In this case the mesh layer indeed is not
>>> useful. I have not worked with S57 before, but if there is OGR driver
>>> available, it should be relatively easy to load and style the data without
>>> a plugin layer. You do not need to rely on styling provided by OGR (if
>>> provided at all). It looks like you only need to load the data as a bunch
>>> of vector layers using OGR (one for each object type) and then apply
>>> styling to those individual layers. Styling of vector layers in QGIS is
>>> fairly strong, with features like rule-based rendering, data-defined
>>> properties and geometry generators you can handle even very complex styles.
>>> After preparing individual styles for vector layers, you can save them to
>>> .qml files, and then your plugin would have just a simple task of taking
>>> the input file(s), load layers and apply saved styles.
>>>
>>> I would resort to writing a custom plugin layer only when when all other
>>> options fail - it is more complex, and generally the user experience is not
>>> great.
>>>
>>> Regards
>>> Martin
>>>
>>>
>>
>> --
>> Eric Younkin
>> Physical Scientist
>> NOAA OCS, Hydrographic Systems and Technology Branch
>> 1315 East-West Highway
>> N/CS11, Room 6604
>> Silver Spring, MD 20910
>> Office: 240-847-8208
>> Cell: 828-331-8197
>>
>
--
Eric Younkin
Physical Scientist
NOAA OCS, Hydrographic Systems and Technology Branch
1315 East-West Highway
N/CS11, Room 6604
Silver Spring, MD 20910
Office: 240-847-8208
Cell: 828-331-8197
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20210304/2a07b33e/attachment.html>
More information about the QGIS-Developer
mailing list