Skip to main content
Solved

How to write line with measure to Postgis?

  • June 17, 2020
  • 4 replies
  • 55 views

Forum|alt.badge.img

Hi,

I'm creating line with measure on vertex and write it to postgis. When I read the same line from postgis, there is no measure.

Is-it possible to write and read measure from Postgis?

Thanks

Best answer by markatsafe

@miladahmad Yes. FME can create PostGIS tables with measures. MeasureGenerator will create measures on a features. The first feature written to a table dictates the structure of the geometry. So make sure the first the features written to the table have measures.

The attached workspace illustrates this. The Sampler has the first feature skip the MeasureGenrator so the table is created with no measures. Remove the Sampler and the table will be created with measures.

Example workspace (FME 2020): PostGIS measures.fmwt

Alternatively, create the tables using pgAdmin or SQL in SQLCreator.

This post is closed to further activity.
It may be an old question, an answered question, an implemented idea, or a notification-only post.
Please check post dates before relying on any information in a question or answer.
For follow-up or related questions, please post a new question or idea.
If there is a genuine update to be made, please contact us and request that the post is reopened.

4 replies

Forum|alt.badge.img+2
  • 1891 replies
  • Best Answer
  • June 17, 2020

@miladahmad Yes. FME can create PostGIS tables with measures. MeasureGenerator will create measures on a features. The first feature written to a table dictates the structure of the geometry. So make sure the first the features written to the table have measures.

The attached workspace illustrates this. The Sampler has the first feature skip the MeasureGenrator so the table is created with no measures. Remove the Sampler and the table will be created with measures.

Example workspace (FME 2020): PostGIS measures.fmwt

Alternatively, create the tables using pgAdmin or SQL in SQLCreator.


Forum|alt.badge.img
  • Author
  • 97 replies
  • June 17, 2020

Thanks for your answer. I do the same but when I read from postgis, the line do not have measure. What do you mean by creating table with SQL? Should I write 2 tables or what? Simply, I have a line, I generate measure and write it to Postgis. Should I do something else?

Thanks


krien
Contributor
Forum|alt.badge.img+10
  • Contributor
  • 30 replies
  • June 17, 2020

Hi miladahmad,

Are you writing to the same PostGis table as you are reading from in the workspace?

If so, I suggest you read the line from the existing PostGis table, add the measure to it and write it to a new table so that table has the spatial DataType with measure in it.

 

Put the original lines in that new table and use this table as input for adding the measures.

Kind regards,

 

Krien Guijt

Forum|alt.badge.img
  • Author
  • 97 replies
  • June 17, 2020

Hi miladahmad,

Are you writing to the same PostGis table as you are reading from in the workspace?

If so, I suggest you read the line from the existing PostGis table, add the measure to it and write it to a new table so that table has the spatial DataType with measure in it.

 

Put the original lines in that new table and use this table as input for adding the measures.

Kind regards,

 

Krien Guijt

thanks a lot. It's working now. I find that it is strange that I should write the table 2 times.