Skip to main content

I'm new to FME and what I'm trying to do with it, is to (semi)automate a process of combining GeoJSON with a PNG background map (12000x12000 px map tile of the area, with pgw file).

Right now I'm doing this process manually with QGIS, and it works, but is a little time consuming.

I've already managed to read the GeoJSON and PNG with separate readers into the FME Workbench. I've added PDFPageFormatter in between and then a PDF 2D writer. Obiously the output is just the background map as a whole and the GeoJSON data somewhere in the middle.

So what I'd like to get some help with, would be:

a) How to crop the output PDF to cover just the area surrounding the GeoJSON and not the whole background map? I've tried this with Clipper transformer, but everytime the whole background map was lost in the process.

b) The GeoJSON data contains basically lines and points with different "objecttype" attributes. I'd like to find a way to customize those, lines with line patterns and points with different custom (svg/png) symbols. Tried MapnikRasterizer but was unable to get this to work at all, and I wasn't sure if it would be the right transformer for the job.

Can you provide the workspace and some data?


A:

The Clipper should be able to clip the PNG raster. If you get a bounding box of your GeoJSON features, buffer it a little bit to avoid them being straight up to the edge of the map and then feed that into the Clipper it should work.

B:

MapnikRasterizer is the way to go for this, but it can be a bit tricky to use.


Thanks!

I couldn't get the clipper to work with GeoJSON -> Tester (to pick out the boundingbox feature type) -> BoundsExtractor -> Bufferer -> Clipper. The only setting I changed in Clipper was Clipper Type: Multiple Clipper to Single Clipper.

On both setting I get an error: "Clipper_Raster(RasterClippingFactory): Internal Error: Failed to add a nodata value to a band with palettes"


Aha, try the RasterInterpretationCoercer to change the raster to RGB or RGBA before putting it in the Clipper.


Wow that actually seemed to do the trick! On setting UInt32 it did the clipping, On any other settings, including those RGB ones or UInt16 I would just get "@ReinterpretRaster: In RASTER mode, if any bands contain palettes then the requested interpretation may only be one of 'UINT8, UINT16, UINT32'"


Reply