1

Do you know if there is any way to recover\rebuild the .dbf and .shx files from the shapefile?

I think my case is a little more nebulous.

My .shp files were extracted from a CSV file... That the data source was an Oracle database

I'm trying to understand how this relationship works

SHP being stored in Oracle without DBF...

Vince
  • 20,017
  • 15
  • 45
  • 64
Silva
  • 11
  • 1
  • 1
    A shapefile is a specific format, binary, and filesytem based (mutltiple files). Geometry can be stored in Oracle, but that's the native SDO_GEOMETRY type (technically part of Locator, and not Spatial). The attributes would be local to Oracle too. CSV is still another format, ASCII, and single-file. Any conversion between these formats would require all the data to be transferred. You can't have fragment in each -- it just doesn't work that way. Please [Edit] your Question to contain more detail. – Vince Sep 16 '22 at 04:31
  • There are tools that can read the .shp part of the shapefile and generate a working .shx part based on that, as well as an empty .dbf part. That way it is possible to get the geometries saved but all the attributes are lost. OpenJUMP for example can do that. But I think that you have actually some other problem. – user30184 Sep 16 '22 at 06:30

2 Answers2

0

I'm not sure I 100% understand the details of the system you are describing, however the main point that you are asking is:

Do you know if there is any way to recover\rebuild the .dbf and .shx files from the shapefile?

Im assuming you want to recover attribute information that was stored in the DBF and the linkages to the .shp, in which case, the simple answer is no.

If using software like ArcGIS and you only have the dbf? won't work. Only have the shx? wont work. Only have the shp? wont work. Other software does not have these limitations, other software does.

Its possible to recover the geometry and generate a 'working' shapefile dataset which will show geometry only, but it will no associated attributes that were once previously associated with it. Tools are available which can recover the geometry only portion of the file (see @user30184 comments).

The DBF contains the attribute information. The SHP contains the geometry elements. The SHX is essentially an index/lookup between the shp and dbf files, linking the two files together.

With your specific scenario and system you describe, IF (and this is a big if) the .shp file is being stored as a blob object inside of Oracle, and the attribute information stored inside a simple table in Oracle, then you could potentially you could recreate your dbf file - but without the shx file, and without intimate knowledge of the data and geometry elements, linking the two back together is not possible.

nr_aus
  • 3,535
  • 6
  • 26
  • 1
    You can rebuild a valid shapefile without the .shx or .dbf. – user2856 Sep 16 '22 at 06:56
  • @user2856 - My answer is written on the assumption that the dbf contains meaningful information about the geometry, which - a geometry only dataset in my opinion is useless, unless you know exactly what it represents....... Technology wise, yes what you say is true and noted and ill amend my answer to reflect the above assumptions, im not quite sure thats what the OP is asking, but ill note it anyways. – nr_aus Sep 16 '22 at 07:21
0

As already mentioned the question is not clear. In particular, there are no details about how the source data was actually loaded into Oracle:

My .shp files were extracted from a CSV file... That the data source was an Oracle database

How was that done ? Using what tool ? And how is the data stored in Oracle ?

So I’m also going to work on an assumption: that the source data was loaded into Oracle as a simple table with the geometry information stored in an SDO_GEOMETRY column.

In this case, extracting the data into an ESRI Shapefile (or any other GIS data structure) can be done easily using any GIS tool. QGIS is one of them. Or the GDAL/OGR tooling, including the ogr2ogr command line.

If this is the case, then I will complete this answer with code examples. If not, then please tell us

Albert Godfrind
  • 2,888
  • 11
  • 11