One Star

[tMap,GeoOperation](cities, regions)=>cities belonging to the regions

Hello,
I've got a question regarding the geographical set of operations avalaible in SDI.
here is my problem:
I've go two input shapefiles: one for the cities, another with regions. These input shapefiles are of multipolygon type...
I put some images with this post so as you figure it out...
I'd like to get a shapefile with all the cities belonging to these regions.
For this, I know I have to use the tMap component, but I don't know which GeoOperation function to use:
contains,
covers,
covered by,
intersects,
overlaps?
If my cities input is row1, my regions row2, could you tell me which expression I have to write?
Thanks!

6 REPLIES
One Star

Re: [tMap,GeoOperation](cities, regions)=>cities belonging to the regions

Hello,
Try Geometry.union() operation to do that.
Regards
One Star

Re: [tMap,GeoOperation](cities, regions)=>cities belonging to the regions

hello,
I have no function Geometry.union available
Maybe you wanted to mention Geometry.intersection?
I attached a screenshot to this post. The cities are in blue. the region contour is in red and fits the cities' contour.
Thanks,
Mathieu
One Star

Re: [tMap,GeoOperation](cities, regions)=>cities belonging to the regions

Hello,
I'm sorry I would like to say : org.talend.sdi.geometry.union(Geometry geom)
The source code of all geometry operation in SDI was here: https://project.camptocamp.com/svn/c2c_talendgeotools/branches/V1_2_x/src/org/talend/sdi/geometry/Ge...

Regards
One Star

Re: [tMap,GeoOperation](cities, regions)=>cities belonging to the regions

Hello,
I tried your method with Geometry.union(row1.the_geom,row2.the_geom)
but it tells me the method "union" is unknown...
Starting job Copy_of_contains at 10:34 28/04/2009.
Exception in thread "main" java.lang.Error: Unresolved compilation problems:
The method union(Geometry) in the type Geometry is not applicable for the arguments (Geometry, Geometry)
org.talend.sdi.geometry cannot be resolved to a type
at general.copy_of_contains_0_1.Copy_of_contains.sShapefileInput_1_GIProcess(Copy_of_contains.java:4014)
at general.copy_of_contains_0_1.Copy_of_contains.runJobInTOS(Copy_of_contains.java:4920)
at general.copy_of_contains_0_1.Copy_of_contains.main(Copy_of_contains.java:4834)
Job Copy_of_contains ended at 10:34 28/04/2009.

The screenshot I attached shows how I tried to process this operation.
Thanks,
Mathieu
One Star

Re: [tMap,GeoOperation](cities, regions)=>cities belonging to the regions

Hi,
On java yo do this :
org.talend.sdi.geometry A,B;
A.union(B);
On tMap you define A and B as a Geometry and you may be do A.union(B);
ctrl+space can help you to find the good operation.
Regards.
One Star

Re: [tMap,GeoOperation](cities, regions)=>cities belonging to the regions

Hi,
It must be an advanced operation.
Could you tell me where I write these lines of code?
org.talend.sdi.geometry A,B;
A.union(B);

I wrote this line in my tMap:
row1.the_geom.union(row2.the_geom)

but i get the following error:
"Starting job union at 09:44 29/04/2009.
Exception in thread "main" java.lang.Error: Unresolved compilation problem:
The operator ! is undefined for the argument type(s) Geometry
at general.union_0_1.union.sShapefileInput_1_GIProcess(union.java:4012)
at general.union_0_1.union.runJobInTOS(union.java:4917)
at general.union_0_1.union.main(union.java:4833)
Job union ended at 09:44 29/04/2009.
"