Question

MongoDB Reader creates GeometryCollections

  • 12 February 2024
  • 1 reply
  • 68 views

Badge +1

MongoDB Reader creates Geometry Collections if the mongo collection contains more than one geometry field. Is there a way to choose which one of these fields should be treated as a geometry?


1 reply

Badge +3

I am not sure if there is a way to solve this within the Reader itself, but I have come up with a couple potential solutions that may help you.

  1. You could use a Deaggregator after the Reader followed by your choice of filter. Examples:
    1. If the input feature has geometry fields with different geometry types, a GeometryFilter after the Deaggregator worked well in my test.
    2. If the input feature has two or more geometry fields which are the same geometry type, but are named differently, an AttributeFilter could be used. In this case I filtered on the “_geometry_name” attribute created by the Deaggregator.
  2. You could use a GeometryPartExtractor after the Reader to select which geometry you want. In my tests I successfully utilized the GeometryPartExtractor to perform the same functions as the Deaggregator + Filter of choice.

Reply