Skip to main content
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

fmelizard
Contributor
Forum|alt.badge.img+17
  • Contributor
  • January 22, 2014
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

david_r
Evangelist
  • January 22, 2014
Hi,

 

 

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

 

 

David

fmelizard
Contributor
Forum|alt.badge.img+17
  • Contributor
  • January 22, 2014
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

takashi
Contributor
Forum|alt.badge.img+19
  • Contributor
  • January 22, 2014
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

  • Author
  • January 23, 2014

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.

david_r
Evangelist
  • January 23, 2014
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

 

 


  • Author
  • January 23, 2014

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

 

 

 

takashi
Contributor
Forum|alt.badge.img+19
  • Contributor
  • January 23, 2014
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?

  • Author
  • January 23, 2014

fmelizard
Contributor
Forum|alt.badge.img+17
  • Contributor
  • January 23, 2014
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

  • Author
  • January 23, 2014
Itay,

 

 

And then?

 

What are my merge parameters in the Feature Merger?

 

 

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

 


takashi
Contributor
Forum|alt.badge.img+19
  • Contributor
  • January 23, 2014
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.

takashi
Contributor
Forum|alt.badge.img+19
  • Contributor
  • January 23, 2014
Every invalid VBO feature has empty as "Geometrie", and "0000000000" as "Identificatie-PND".  

fmelizard
Contributor
Forum|alt.badge.img+17
  • Contributor
  • January 23, 2014
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

fmelizard
Contributor
Forum|alt.badge.img+17
  • Contributor
  • January 23, 2014
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

fmelizard
Contributor
Forum|alt.badge.img+17
  • Contributor
  • January 23, 2014
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

takashi
Contributor
Forum|alt.badge.img+19
  • Contributor
  • January 23, 2014
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?

takashi
Contributor
Forum|alt.badge.img+19
  • Contributor
  • January 23, 2014
Posts were crossing. I see, that's right.

fmelizard
Contributor
Forum|alt.badge.img+17
  • Contributor
  • January 23, 2014
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

  • Author
  • January 23, 2014
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!

 


fmelizard
Contributor
Forum|alt.badge.img+17
  • Contributor
  • January 23, 2014
a small advantage I admit....

Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings