AddLayerFromDatabase

Hi everyone,

I add layer using
axmap1.AddLayerFromDatabase method. I use dynamic loading and axmap1.get_OgrLayer() method.

var x = axmap1.addLayerFromDatabase();
var y = axMap1.get_OgrLayer(x);
var sf = y.GetBuffer();
sf.Generate.Labels() --> this method creates nonsense characters.

When i try to generate labels it doesn’t encode UTF-8 format.It creates nonsense characters.I also tried this issue in MapWindow.When i add layer from database to MapWindow it also creates nonsense characters.I use PostgreSQL

I noticed that this issue only occurs in large layers.As far as i know default OgrLayerMaxFeatureCount is 50000.if the layer column size is below 50000 it shows correctly,but if it is more than 50000 it shows nonsense characters in labels.I also tried in MapWindow.It is the same result
Thanks

I’m sorry for the delay. I want to let you know that I do not yet have anything to report. I have started to look at the code, but I am not very familiar with the dynamic loading process. Perhaps @Mathijs.Dumon has some insight into this? Even so, I will spend more time looking into it.

Regards,
Jerry.

Hi!

I haven’t had (or checked) this particular issue but I’m working on SQLServer. Not that that should matter much. I’ve been trying to get the ‘dynamic’ loading working again but it’s still work in progress.

I’m about to start working on this again the coming weeks. Chances are the next release will have a working version for labels (and also styles) on dynamic layers.

As a workaround you increase the maximum feature count to something big enough. In mapwindow that can be done from the settings menu (Tools -> Settings) under Data -> Vector and then check the value for the maximum number of features (under OGR datasources).

With mapwingis you choose to increase the global limit (in GlobalSettings) or per-layer:
https://www.mapwindow.org/documentation/mapwingis4.9/class_ogr_layer.html#a8450e0ce062bcc29d04c26f633a1ff98
https://www.mapwindow.org/documentation/mapwingis4.9/class_global_settings.html#ad55425992f2e70a6fda68a5ddaf630d7