Solved

Dynamically read attributes from Spatialite files


Badge

Hey folks, I'm trying to accomplish a fairly simple thing, which is to create a workspace that can read, transform, and write different Spatialite files with different attributes. I'm pretty certain that I've been able to do this earlier with other formats, but I can't get it to work with this format. 

The problem is that when I add a Spatialite reader, selecting "Single merged feature type", the attritbutes from this file are read and added to the feature type. Then, if I change the file source to another Spatialite with a different set of attributes, i get the message 

SPATIALITE reader: Feature type 'natural' does not contain an attribute matching the schema attribute 'landuse', skipping attribute 'landuse'

SPATIALITE reader: Feature type 'natural' does not contain an attribute matching the schema attribute 'leisure', skipping attribute 'leisure'

SPATIALITE reader: Feature type 'natural' does not contain an attribute matching the schema attribute 'amenity', skipping attribute 'amenity'

SPATIALITE reader: Feature type 'natural' does not contain an attribute matching the schema attribute 'military', skipping attribute 'military'

and the resulting features will contain the above attributes with no values. It seems that no matter what I do, the reader refuses to read the attributes if they do not match the ones that was read when the reader was first added.

I have looked at the Dynamic Workflows tutorials but they seems to solve problems that are more complicated than mine. Any help would be greatly appreciated!

icon

Best answer by takashi 2 May 2016, 14:37

View original

4 replies

Userlevel 2
Badge +17

Hi @mbu, I was able to reproduce the same symptom as yours with FME 2016.1. It might be a bug of the SPATIALITE reader. If you are using FME 2015.1+, try using the FeatureReader as an interim workaround, like this screenshot (FME 2016.1)

Userlevel 4
Badge +25

Hi. Yes, that looks like a definite bug. I've filed PR#68137 and will let you know what the developers say about it. If this is for an urgent project, or it prevents you from carrying out the project completely, then let me know and I can try to increase the priority of the issue.

Badge

This worked, thank you so much Takashi! I hope this gets fixed as it might confuse newcomers as to how a dynamic workspace should work.

Edit: Thanks for the reply, Mark. This is not really an urgent issue for me and the workaround is fine for now :)

Userlevel 4
Badge +25

This worked, thank you so much Takashi! I hope this gets fixed as it might confuse newcomers as to how a dynamic workspace should work.

Edit: Thanks for the reply, Mark. This is not really an urgent issue for me and the workaround is fine for now :)

Great. I've just been told this will be fixed in 2017 by a new parameter on readers called "Attributes to Read". By default it will be set to all attributes, giving us the correct behaviour.

 

 

Reply