3

Does anyone know how to extract metadata information from a shapefile in FME?

To be exact, i want to extract the schema (data structure) of the data such as the field names, etc. from a shapefile and export as a xml or any format.

Example, if i have a shapefile named 'Road', i want to extract its field names like road name, road length etc and export it in xml preferably rather than viewing the field names of the shapefile in a datainspector.

  • 2
    What type of metadata? Can you edit your question to include exactly what you want to do and what you've tried? – Fezter Dec 9 '14 at 6:49
  • 1
    If any format is acceptable, why not just use the .dbf that accompanies the .shp file? – nmtoken Dec 9 '14 at 9:31
  • Well sure.Could you suggest how to export a field names alone from a dbf to xml – User123 Dec 9 '14 at 9:41
  • If you are coding this in .NET, you could load up the DBF file as a DataTable, which has built in methods for table schema. – Branco Dec 22 '14 at 20:55
  • Have you tried using the "Schema (Any Format)" reader? – blah238 Dec 22 '14 at 21:18
1

Multiple options:

Workbench

Static: Schema (Any Format) Reader

SchemaReaderParameters

Dynamic: FeatureReader Transformer Use Creator to initiate proces. Define folder in Dataset. Choose Schema Features in Schema/Data Features. Connect output port.

FeatureReaderParameters

Result:

attribute{0}.fme_data_type (string) fme_varchar(10)
attribute{0}.name (string)  CTE
attribute{0}.native_data_type (string)  char(10)
attribute{1}.fme_data_type (string) fme_varchar(50)
attribute{1}.name (string)  THEMA
attribute{1}.native_data_type (string)  char(50)
attribute{2}.fme_data_type (string) fme_varchar(50)
attribute{2}.name (string)  THEMB
attribute{2}.native_data_type (string)  char(50)
...
1

It seems you want to create schema document(*.xsd) out of the shapefile. You can do this in Arcmap 10.1 Exporting data in xml file format, which can export any feature or raster class to xml document. From there you can convert it into *.xsd document with the help of several online convertors like FreeFormatter.com and xmlgrid.net.

In Arcmap, add shapefiles into geodatabase and then run the conversion tool.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.