Skip to content

Commit

Permalink
Feature: support open parquet file (#2456)
Browse files Browse the repository at this point in the history
  • Loading branch information
lixun910 committed Oct 11, 2023
1 parent 8b043c8 commit 40003fc
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 1 deletion.
5 changes: 5 additions & 0 deletions DataViewer/DataSource.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ bool IDataSource::IsWritable(GdaConst::DataSourceType ds_type)
ds_type == GdaConst::ds_gpkg ||
ds_type == GdaConst::ds_mysql ||
ds_type == GdaConst::ds_oci ||
ds_type == GdaConst::ds_parquet ||
ds_type == GdaConst::ds_postgresql )
return true;
return false;
Expand Down Expand Up @@ -141,6 +142,8 @@ wxString IDataSource::GetDataTypeNameByExt(wxString ext)
ds_format = "Idrisi";
else if(ext.CmpNoCase("ods")==0)
ds_format = "ODS";
else if(ext.CmpNoCase("parquet")==0)
ds_format = "Parquet";

//else
// ds_format = "Unknown";
Expand Down Expand Up @@ -192,6 +195,7 @@ IDataSource* IDataSource::CreateDataSource(wxString data_type_name,
type == GdaConst::ds_gpkg ||
type == GdaConst::ds_xls ||
type == GdaConst::ds_xlsx ||
type == GdaConst::ds_parquet ||
type == GdaConst::ds_geo_json )
{
// using <file>xxx</file> to create DataSource instance
Expand Down Expand Up @@ -249,6 +253,7 @@ IDataSource* IDataSource::CreateDataSource(wxString ds_json)
type == GdaConst::ds_gpkg ||
type == GdaConst::ds_xls ||
type == GdaConst::ds_xlsx ||
type == GdaConst::ds_parquet ||
type == GdaConst::ds_geo_json )
{
json_spirit::Value json_ds_path;
Expand Down
1 change: 1 addition & 0 deletions DialogTools/DatasourceDlg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ void DatasourceDlg::Init()
ds_file_path = wxFileName("");

// create file type dataset pop-up menu dynamically
ds_names.Add("GeoParquet (*.parquet)|*.parquet");
ds_names.Add("ESRI Shapefile (*.shp)|*.shp");
ds_names.Add("ESRI File Geodatabase (*.gdb)|*.gdb");
ds_names.Add("GeoJSON (*.geojson;*.json)|*.geojson;*.json");
Expand Down
11 changes: 11 additions & 0 deletions GdaConst.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -773,6 +773,17 @@ void GdaConst::init()
datasrc_field_illegal_regex[ds_dbf] = db_field_name_illegal_regex;
datasrc_field_casesensitive[ds_dbf] = false;

datasrc_str_to_type["Parquet"] = ds_parquet;
datasrc_type_to_prefix[ds_parquet] = "";
datasrc_type_to_fullname[ds_parquet] = "Parquet";
// share the same with DBF
datasrc_table_lens[ds_parquet] = 128;
datasrc_field_lens[ds_parquet] = 10;
datasrc_field_warning[ds_parquet] = default_field_warning;
datasrc_field_regex[ds_parquet] = db_field_name_regex;
datasrc_field_illegal_regex[ds_parquet] = db_field_name_illegal_regex;
datasrc_field_casesensitive[ds_parquet] = false;

datasrc_str_to_type["ESRI Shapefile"] = ds_shapefile;
datasrc_type_to_prefix[ds_shapefile] = "";
datasrc_type_to_fullname[ds_shapefile] = "ESRI Shapefile";
Expand Down
3 changes: 2 additions & 1 deletion GdaConst.h
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,8 @@ class GdaConst {
ds_esri_personal_gdb, ds_esri_arc_sde,
ds_csv, ds_dbf, ds_geo_json, ds_gml, ds_kml,
ds_mapinfo, ds_mysql, ds_ms_sql, ds_oci, ds_odbc, ds_postgresql,
ds_shapefile, ds_sqlite, ds_gpkg, ds_wfs, ds_xls, ds_xlsx, ds_osm, ds_ods, ds_cartodb, ds_unknown };
ds_shapefile, ds_sqlite, ds_gpkg, ds_wfs, ds_xls, ds_xlsx, ds_osm,
ds_ods, ds_cartodb, ds_parquet, ds_unknown };

static std::map<std::string, DataSourceType> datasrc_str_to_type;
static std::map<DataSourceType, std::string> datasrc_type_to_str;
Expand Down

0 comments on commit 40003fc

Please sign in to comment.