Skip to main content
Hello,

 

How to determine if input dataset choesn by user has geometry or not. I want to process spatial data by extracting co-ordinates but there could be non-spatial data as well. So I need to to develop two branches one for spatial data and other for non-spatial data?

 

 

how to go about it?
Hi,

 

 

you can use a GeometryFilter: the features exiting through the NULL port have no geometry.

 

 

David
Thanks for your quick response. GeometryFilter will check each and every feature that could work but in my case user either could select Spatial dataset e.g.shp or mid.mif or he/she could select non-spatial data e.g. csv or txt data file. I need to process both files in different way. So needto figure out whether file is spatial or non-spatial. Is there any better way?
use a file/derectory reader and check extension?
Two solutions I can think of.

 

 

Probably a Startup script (Python or Tcl) would do the job. You could create a script to examine the source file parameters to determine what type of data is being read.

 

 

Alternatively, use the GeometryFilter to determine whether the data is spatial or tabular, and then connect the output to a WorkspaceRunner to run a different workspace depending on the geometry type. A Sampler transformer would let you reduce it to testing a single feature, to speed things up and ensure the workspaceRunner is only triggered once.

 

 

Hope this helps

 

 

Mark

 

 

Mark Ireland

 

Product Evangelist

 

Safe Software Inc.
Thanks Mark. GeometryFilter will test each and every feature but I am not able to figure out how to make sure that WorkspaceRunner is triggered only once.
Thanks mark. Got it. Using Sampler done the trick.

Reply