Skip to main content

Hello!

 

I need to convert shape and geojson files from one pathe into the opposite file type (shape/geojson). I already created a Workspace with the reprojector. This has to work with the WorkspaceRunner, because it has to run through the whole amount of new files every time. My question now: How can I make my Workbench realize if it is a GeoJSON or Shapefile to continue the process? Does this need to be defined in the workspace Setting? Thanks a lot.

 

Best

 

Sara

 

Hi @sara_lenakordas,

You can read the files via the Directory and File Pathnames Reader, this will give you the information you need, just make sure the retrieve file properties is set to yes.

Hope this helps,

Itay


Thank you @itay! I still stumble across some Problems, although I though this FME process should be done quite quick and easily.

 

This is my workbench...

 

Path where the JSON and Shapefiles are stored

 

Feature Reader GeoJSON

Feature Reader Shapefile

 

Maybe you have an idea how to approach it in a different way? Thanks a lot.

 


In both 2022.2.5 and 2023.0.0, I am unable to read DWG files or DGN files.

 

The translation log reads:

DWG

AutoCAD Reader: An error occurred for dataset 'xxx.dwg', in function AutoCAD2004Reader::open. Exception thrown: 'Extended error' (The file cannot be accessed by the system.
 
SCENEOE_23.9fme_17.tx)
 
Failed to obtain any schemas from reader 'ACAD' from 1 datasets. This may be due to invalid datasets or format accessibility issues due to licensing, dependencies, or module loading. See logfile for more information
 
Translation FAILED.
Error running translation.
Workspace generation failed.  Parameter file was C:\Users\JSDBRO~1\AppData\Local\Temp\FME_1683040838597_37964.

image.pngDGN

FME API version of module 'acad/ACAD' matches current internal version (4.0 20220615)
 
AutoCAD Reader: An error occurred for dataset 'xxx.dgn', in function AutoCAD2004Reader::open. Exception thrown: 'Extended error' (The file cannot be accessed by the system.
 
SCENEOE_23.4fme_16.tx)
 
Translation was SUCCESSFUL
Error running translation.

The experience with DGN will allow Reader Types to be added to the workbench and feature counts can be seen, but no data is visible to the following transformers.

 

image 

Windows 11


Hi @sara_lenakordas,

First I would use a tester after the Directory and File Pathnames testing for json or shp using the path_extension attribute.

This way you read all the files but end up with only the file you want to read (e.i. shp and json) and not shx or prj, etc.

Then use the path_windows attribute value in the FeatureReader, this holds the location of each file.

This way the FeatureReader will read the files.

Beacuse you are using an attribute value in the dataset setting of the FeatureReader, the FeatureReader will complain about the Feature Types to Read, just ignore and press cancel, the features will come out of the generic port.

Hope this helps,

Itay

Thanks for your suggestion @itay! This really brings the solution very near. I also tried it with the tester option and the path_windows option in the FeatureReader. My problem is that if I choose the path_extension shp in the Tester he is not taking the relevant other files of the Shape file (shx/prj/dbf). I now used 5 Tester for each file (shp/shx/prj/dbf/json) and took the passed 4 elements shp/shx/prj/dbf together as input for the FeatureReader. Would you also approach it this way?


Reply