Solved

Convert multiple ESRI shape files into SQL Server Geography

  • 19 June 2019
  • 2 replies
  • 10 views

I have a number of ESRI shape files that need Sqlising. Each shape file goes into a SQL Server Database table as a single row. How do I achieve this in one workflow? Doing these one by one is not practical as there are hundreds of shape files and I can easily make a mistake plus not repeatable.
icon

Best answer by erik_jan 19 June 2019, 17:38

View original

2 replies

Userlevel 2
Badge +12

Two ways of doing this:

1) Point the Shape reader to <your folder>\\*.shp to read all Shape files in one go

2) Create a workspace to process 1 Shape file and a "runner" workspace using a "Directory and File Path" reader. This reader gets the file names (shp files) and not the contents. Follow the reader by a WorkspaceRunner transformer to call the workspace for processing a Shape file and pass the attribute containing the file name to the parameter in the WorkspaceRunner. This will create a loop to run the same workspace for each Shape file in the folder.

Option 1 is the easier, option 2 more flexible.

Hope this helps.

Badge +8

Hi @chapmans1982, As erik_jan mentioned both the above-mentioned steps would work, but just want to clarify the following

 

Incoming shapefiles have identical SCHEMA

 

Or else, the schema will be taken from the 1st incoming features and geometry and attributes will be written to same SQL table.

Under MSSQL Spatial Writer --> Parameters --> SpatialType > Set Value to Geography

Please find attached Template using FME tutorial data esrishape2mssql_spatial.fmwt

Reply