You are not logged in.

Unanswered posts



Important! This site has been replaced. All content here is read-only. Please visit our brand-new community at https://community.talend.com/. We look forward to hearing from you there!



#1 2017-03-16 22:19:44

hernandezpaul
Member
3 posts

hernandezpaul said:

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 

Offline

#2 2017-03-17 13:14:11

Fxp
Member
193 posts

Fxp said:

Re: Import shapefile attributes - how to?

Hi, 

you could probably download the demo workspace https://github.com/talend-spatial/works … mo-spatial which contains some tMap making spatial join (eg. https://github.com/talend-spatial/works … /Routines).

HTH

Francois

Offline

#3 2017-03-17 17:42:17

hernandezpaul
Member
3 posts

hernandezpaul said:

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 smile
Kind Regards, 
Paul.

Offline

#4 2017-03-19 14:52:29

hernandezpaul
Member
3 posts

hernandezpaul said:

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:

mini_crateSchema.jpg_20170320-0033.jpg

mini_blob_20170320-0037.png

2) This is the job overview:

mini_blob_20170320-0034.png

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

mini_blob_20170320-0035.png

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.

mini_blob_20170320-0038.png

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

mini_blob_20170320-0039.png

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:

mini_blob_20170320-0039.png
 

I hope this helps someone else.

Kind regards, 

Paul

Last edited by hernandezpaul (2017-03-20 08:40:38)

Offline

Board footer

Talend Contributor Agreement - Talend Website Privacy Policy