Question

Extracting XY from csv to shape


Hi,

 

 

I've got an CSV file with 'hidden' XY in a column.

 

It's like this:

<gml:Point xmlns:gml="http://www.opengis.net/gml" srsName="urn:ogc:def:crs:EPSG::28992" srsDimension="2"><gml:pos>240664.000 488240.000</gml:pos></gml:Point>

 

 

I want the two coordinates to be seperate columns in the new (point) shape.

 

How do I do that?

 

 

Thanks for any help!

21 replies

Userlevel 4
Badge +13
Hi Joost,

 

 

If you could read it as GML then the features geometry will be read correctly  as points, then its a simple matter of writting it to shape.

 

 

Itay
Userlevel 4
Hi,

 

 

you can use a GeometryReplacer with "Geometry encoding" set to GML

 

 

David
Userlevel 4
Badge +13
True did think of that, but you will need to read the csv  with the text file reader ( set to read all at once)

 

Good catch David!

 

 

Itay
Userlevel 2
Badge +17
Hi,

 

 

I agree with David. And then, you can also extract coordinate of created point with the CoordinateExtractor to store x, y into separate columns.

 

 

Takashi

Thanks for all the help.

But I'm now getting a warning:

CoordinateExtractor: <index> parameter to @Coordinate must be an integer -- `<gml:Point xmlns:gml="http://www.opengis.net/gml" srsName="urn:ogc:def:crs:EPSG::28992" srsDimension="2"><gml:pos>241828.000 486863.000</gml:pos></gml:Point>' is invalid

 

What am I doing wrong?

 

It looks like I'm doing something wrong at the XCoordinate Extractor.

 

 

I go from CSV to Geometry Replacer then to Coordinate Extractor then to the Attribute Exposer and then to my output format.
Userlevel 4
Hi,

 

 

how have you configured the CoordinateExtractor?

 

 

To extract the coordinates for a point, this is how it should look:

 

 

 

 

Do not send the GML geometry string into any of the parameters.

 

 

David

 

 

Thanks.

 

It all worked out now.

 

 

Except for some strange extra codes ('????') which appear at the end of both coordinates. But those I can remove in Textpad, so most of my problems are solved.

 

 

Thanks for all the help!

 

 

Joost

 

 

 
Userlevel 2
Badge +17
Good to hear you got a solution. But I worry that the extra codes have appeared. If such a result always occurs, it could be a critical issue on the CoordinateExtractor. Could you please explain the situation a little more in detail?
In the link you can download the files which i use.

 

 

https://www.wetransfer.com/downloads/6a9a44adeff8b32af1abf6b9fd70ba7820140123122257/33e5c6a6a4327ffd98b1399279416eb520140123122257/f6714c
Userlevel 4
Badge +13
Hoi Joost,

 

 

Its quite simple you have 212 VBO's without geometry values, next to that if you are relating VBO's to panden you better use the process duplicate suppliers, since 1 pand can have more than 1 VBO.

 

 

Itay
Itay,

 

 

And then?

 

What are my merge parameters in the Feature Merger?

 

 

I don't need a Geometry Merge Type, do I?

 

Userlevel 2
Badge +17
I inspected your sample data. As Itay mentioned, there are 212 invalid VBO features. Since they have wrong GML syntax, the GeometryReplacer cannot transform them to points. You can detect them with the XMLValidator transformer. Every PND feature has unique "Identificatie-PND", so I don't think you need to use "Process Duplicate Suppliers" option in this case. I confirmed the uniqueness using the DuplicateRemover.
Userlevel 2
Badge +17
Every invalid VBO feature has empty as "Geometrie", and "0000000000" as "Identificatie-PND".  
Userlevel 4
Badge +13
Hoi Joost,

 

 

Your settings are correct the setting for the geometry merge type dont matter, make sure you specify a list name so that all the 1:N relations are resulting.

 

 

Itay
Userlevel 4
Badge +13
optionally you can use the Joiner with the panden csv, make sure the cardinality is 1:M and select the fields you want to add from the panden csv.

 

The result can  be queried on the _matched_records attribute, for a 1:1 or 1:M relation.

 

 

Itay
Userlevel 4
Badge +13
True the pnd id is unique, but the realtionship vbo <>pnd can be 1:M I have tested the data and there are 1:M relationships between the pnd and vbo (as expected with BAG data).

 

 

This is only of significance if  Joost really needs this information.

 

 

Itay
Userlevel 2
Badge +17
Itay, in my inspecting result, VBO (Requestor) : PND (Supplier) = N : 1, was not 1 : N. So I thought it's unnecessary to use "Process Duplicate Suppliers" option. Am I missing something?
Userlevel 2
Badge +17
Posts were crossing. I see, that's right.
Userlevel 4
Badge +13
I will explain a bit about the data, pnd are buildings (panden in dutch) and vbo are points representing the adress and other attributes.

 

The buildings can have a vbo, or multiple vbo's or none at all.

 

So to test for a 1:M relation the pnd should be used as requestor, naturally you can establish the 1:M relation this way to (vbo as requestor) but it makes more sense (for me) to have a building with none/one/multiple adresses.

 

 

I hope this makes sense :)

 

 

Itay
I want to thank you both for all your help. Itay was in advantage becauce of his knowledge about the dutch BAG :)

 

 

It's clear that I have a lot to learn about working with FME. And I'm really glad that there is a community like this for people like me!

 

Userlevel 4
Badge +13
a small advantage I admit....

Reply