Import shapefile attributes - how to?

Five Stars

Import shapefile attributes - how to?

Hi everyone, 
I am using the spatial plug-ins to perform the following task.  I have a dataset with X and Y coordinates.  I have also a shapefile with multi polygons and two metadata attributes, name and Id. The idea is to look-up the names in the shapefile with the coordinates.  With a point in polygon it will be determined to which polygon belongs a point. 
I am using the shapefile input component which points to the  .shp file. 
I am facing to hurdles :
- I cannot retrieve the name and I'd from the file.  I can only see an attribute call the_geom. How can I read the metadata? 
- The second thing is, the file contains a multi polygon and I don't know how to iterate over it in order to perform a Contains or intersect with the points.
Any comment will be highly appreciated. 
Kind regards, Paul 
One Star Fxp
One Star

Re: Import shapefile attributes - how to?

you could probably download the demo workspace which contains some tMap making spatial join (eg.
Five Stars

Re: Import shapefile attributes - how to?

Hi Francois, 
thanks for the quick answer. The demo workspace is the right one for the version of the plugins I downloaded. I have downloaded another version which didn't help me. 
Now it seems to work, at least I had a looked at how to create a shapefile schema in the metadata repository and I am able to see not only the geometry but also the others attributes. I hope I can have enough time to post my complete solution. 
Great tools by the way Smiley Happy
Kind Regards, 
Five Stars

Re: Import shapefile attributes - how to?

Hi, I solved almost everything. I want to briefly share my solution with you:
1) Create a generic schema under metadata:

2) This is the job overview:

3) I read the shape file using a sShapeFileInput component:

4) The shapefile contains multipolygons and I want to have polygons. My solution was to use a sSimplify component. I used the default settings.
5) The projection of the shapefile was "MGI / Austria Lambert" which corresponds to EPSG 31287. I want to re-project it as EPSG 4326 (GCS_WGS_1984) which is the one used by my input coordinates.
6)  I read the x, y coordinates from a csv file.

7) With a s2DPointReplacer I converted the x,y coordinates as Point(x,y)

This part was tricky, I needed to swap the x, y assignment to x = Latitude and y = longitude because the points in the polygons have this format --> Point(lat, long)
8)Finally I created an expression in a tMap just to get the polygon, poin intersection. I guess a contains would also work:
I hope this helps someone else.
Kind regards, 

Cloud Free Trial

Try Talend Cloud free for 30 days.


Introduction to Talend Open Studio for Data Integration.

Definitive Guide to Data Integration

Practical steps to developing your data integration strategy.

Definitive Guide to Data Quality

Create systems and workflow to manage clean data ingestion and data transformation.