Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[pull] master from OSGeo:master #124

Merged
merged 3 commits into from
Dec 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/code_checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ jobs:
run: |
git clone https://github.com/danmar/cppcheck
cd cppcheck
git checkout 690aab586136cf596b84ef04a61337813609d716 # FIXME: Workaround https://github.com/danmar/cppcheck/pull/6906#issuecomment-2539097133
mkdir build
cd build
cmake .. -DCMAKE_BUILD_TYPE=Release
Expand Down
4 changes: 4 additions & 0 deletions autotest/gdrivers/tiledb_write.py
Original file line number Diff line number Diff line change
Expand Up @@ -451,6 +451,10 @@ def test_tiledb_write_create_group(tmp_path):
assert ds.RasterYSize == 2


@pytest.mark.skipif(
gdaltest.is_travis_branch("build-windows-conda"),
reason="Fails with tiledb 2.27. Seehttps://github.com/OSGeo/gdal/issues/11485",
)
def test_tiledb_write_overviews(tmp_path):

# This dataset name must be kept short, otherwise strange I/O errors will
Expand Down
10 changes: 10 additions & 0 deletions autotest/ogr/ogr_geojson.py
Original file line number Diff line number Diff line change
Expand Up @@ -2914,6 +2914,16 @@ def test_ogr_geojson_58(tmp_vsimem):
ds = None


###############################################################################
# Test using the name member of FeatureCollection


def test_ogr_geojson_empty_name():

with ogr.Open('{ "type": "FeatureCollection", "name": "", "features": []}') as ds:
assert ds.GetLayer(0).GetName() == "OGRGeoJSON"


###############################################################################
# Test using the description member of FeatureCollection

Expand Down
10 changes: 10 additions & 0 deletions ogr/ogrsf_frmts/geojson/ogr_geojson.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,16 @@ class OGRGeoJSONLayer final : public OGRMemLayer
static const char *const DefaultName;
static const OGRwkbGeometryType DefaultGeometryType;

static const char *GetValidLayerName(const char *pszName)
{
if (pszName == nullptr || pszName[0] == 0)
{
// Can happen for example if reading from /vsistdin/
pszName = OGRGeoJSONLayer::DefaultName;
}
return pszName;
}

OGRGeoJSONLayer(const char *pszName, OGRSpatialReference *poSRS,
OGRwkbGeometryType eGType, OGRGeoJSONDataSource *poDS,
OGRGeoJSONReader *poReader);
Expand Down
4 changes: 2 additions & 2 deletions ogr/ogrsf_frmts/geojson/ogrgeojsonreader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -419,6 +419,7 @@ bool OGRGeoJSONReader::FirstPassReadLayer(OGRGeoJSONDataSource *poDS,
if (STARTS_WITH_CI(pszName, "GeoJSON:"))
pszName += strlen("GeoJSON:");
pszName = CPLGetBasename(pszName);
pszName = OGRGeoJSONLayer::GetValidLayerName(pszName);

OGRGeoJSONLayer *poLayer = new OGRGeoJSONLayer(
pszName, nullptr, OGRGeoJSONLayer::DefaultGeometryType, poDS, this);
Expand Down Expand Up @@ -930,9 +931,8 @@ void OGRGeoJSONReader::ReadLayer(OGRGeoJSONDataSource *poDS,
pszName = CPLGetBasename(pszDesc);
}
}
if (pszName == nullptr)
pszName = OGRGeoJSONLayer::DefaultName;
}
pszName = OGRGeoJSONLayer::GetValidLayerName(pszName);

OGRGeoJSONLayer *poLayer = new OGRGeoJSONLayer(
pszName, nullptr, OGRGeoJSONLayer::DefaultGeometryType, poDS, nullptr);
Expand Down
Loading