Hi Alexander,
Here are my results with new corrected file with schema.
All conversions succeeded except Osm that blocked.
1.This my edit code (is OK?):
Caller:
// Build conversion Options
var context = new ConversionContext();
if (gisSourceFormatOption.Equals(“Gml”, StringComparison.OrdinalIgnoreCase))
{
context.HasGmlSchema = ConversionOptionsDetector.HasGmlSchema(gisInputFilePath);
}
var options = ConverterUtils.BuildConversionOptions(
gisSourceFormatOption,
gisTargetFormatOption,
context);
The function please see the bold code:
///
/// Source options strategy for GML inputs.
///
///
/// Provides reader-side option composition for GML source data. This strategy is:
/// - Pure and small: it mutates the supplied only and performs no I/O.
/// - Advisory: it applies configuration based on hints in , where
/// null values are treated as “unknown” and conservative defaults are preserved.
///
/// Behavior:
/// - When == false, the strategy enables
/// so the GML reader will attempt to restore attribute collection
/// schema information that may be required by downstream processing.
/// - When the hint is null or false, the default GML reader behavior is preserved.
///
/// Usage:
/// - Use when composing source driver options (for example via ).
/// - Treat schema restoration as potentially altering parsing semantics; document and test any cases where
/// enabling schema restore changes conversion output.
///
public class GmlSourceStrategy : ISourceOptionsStrategy
{
///
/// Canonical format name handled by this strategy.
///
public string Format => “Gml”;
/// <summary>
/// Apply GML-specific source/reader options to the provided <see cref="ConversionOptions"/>.
/// </summary>
/// <param name="options">Conversion options to mutate. Must not be null.</param>
/// <param name="context">Optional conversion context containing hints such as <see cref="ConversionContext.HasGmlSchema"/>.</param>
/// <remarks>
/// - Sets <see cref="GmlOptions.RestoreSchema"/> = <c>false</c> when the context has GML schema
/// is present. Otherwise sets <see cref="GmlOptions"/> to true to restore the GMLschema.
/// - The method mutates <paramref name="options"/> only and performs no file I/O.
/// </remarks>
public void Apply(ConversionOptions options, ConversionContext context)
{
**var gmlOptions = new GmlOptions();**
**if (context?.HasGmlSchema == true)**
** {**
** gmlOptions.RestoreSchema = false;**
** }**
gmlOptions.RestoreSchema = true;
options.SourceDriverOptions = gmlOptions;
}
}
2.Please see:
Input-Gml
image.png (11.5 KB)
Csv:
The order of the columns not like the input (gml):
image.png (1.7 KB)
Gdb
The location of the point not like the input (gml).
3.Test data(input, output, QGIS)
Task 4542-Gpx with shcema-All formats.zip (51.9 KB)