Doing a spatial join in KNIME

Hi,

I receive large parquet file (approx. 10 million rows) that lists incidents and their coordinates (latitude and longitude) but no additional information on a weekly basis. At some stage in the flow, I need to do a spatial join to merge attributes from 2 shapefiles that contain polygons that define specific regional and adminsistrative information to the incident points.

I can take the data out of the KNIME to do the spatial join in QGIS or ESRI ArcGIS and then bring it back to finish the workfow, but this a flow that I would like to schedule and run autonomously.

I have tried a number of strategies to merge the data but have not been successful. If anyone has done a spatial join, or has some ideas of how it could be done, I would really appreciate any pointers.

Thanks

tC/.

Hi @TigerCole,

have you tried Relate Geometries – KNIME Hub
yet? I got it to work with Smallworld shapefiles for pipes.

Best regards,
Paul

Hi @goodvirus ,

I did try that, but unfortunately, it does not work unless the number of rows in each input table matches. I should maybe try using a chunk loop.

Time for some python or a java snippet maybe.

tC/.

Looks like you want to find which polygon a point is inside off. I remember a similar question being asked recently. Maybe those two links help you out:
Point in polygon - Wikipedia

In this thread there’s an implementation for the ray casting algorithm in R. It should be easy to adapt it for Java Snippets.
It should also not be too difficult to either loop over all polygons with a recursive loop or expand the algorithm to return the surrounding polygon within a single node.

Hi @Thyme …

This is what I am looking for. I will look at migrating it to a Java snippet, but because I do so much geospatial stuff at the moment, I will probably take some time out and look at using a java geospatial library that has wide functionality and build a set of nodes I can reuse.

Thanks for the reference.

tC/.

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.