Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us in Bucharest on Sept 18th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
hernandezpaul
Contributor II
Contributor II

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 
Labels (2)
3 Replies
Anonymous
Not applicable

Hi, 
you could probably download the demo workspace  https://github.com/talend-spatial/workspace-demo-spatial which contains some tMap making spatial join (eg. https://github.com/talend-spatial/workspace-demo-spatial/tree/6.x/DEMO-SPATIAL/process/Spatial/test_....
HTH
Francois
hernandezpaul
Contributor II
Contributor II
Author

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  0683p000009MACn.png
Kind Regards, 
Paul.
hernandezpaul
Contributor II
Contributor II
Author

Hi, I solved almost everything. I want to briefly share my solution with you:
1) Create a generic schema under metadata:
0683p000009MCzc.jpg
0683p000009MDim.png
2) This is the job overview:
0683p000009MDje.png
3) I read the shape file using a sShapeFileInput component:
0683p000009MDjj.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.
0683p000009MDjo.png
7) With a s2DPointReplacer I converted the x,y coordinates as Point(x,y)
0683p000009MDjt.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:
0683p000009MDjt.png 
I hope this helps someone else.
Kind regards, 
Paul