Skip to main content

Hi everybody,

I have problems to show geometry after SQL statement.

Inputs:

-PostGIS public database: geometry (polygons) & table

 

I am using the SQLCreator transformer and my query (SQL Statement) works properly but in Data Inspector only the table result of my query is showed but not spatial elements.

I´ve tried to use 'GeometryExtractor' in order to extract the geometry column, It does but neither shows spatial elements.

 

Any idea? I don´t know what I am doing wrong?

Thanks,

Juanjo

Hi @geodesman,

The SQLCreator should be creating the geometry for you if it's only a single geometry table. Can you check to see if the geometry exists on the feature by inspecting the feature cache of the SQLCreator and then clicking on one of the features in the feature table. Note: you will need to have the feature information window button selected:

 

 

If the feature has geometry, you should be able to see it in the graphics view if graphics view is toggled on:

 

Additionally, have you also tried using the PostGIS Reader to see if the geometry is read in correctly?


Thanks chrisatsafe for your answer,

I am triying a similar query with SQLExecutor with a same wrong result.

-the geometry exists on the feature , not on the result or rejected on SQLExecutor.

 

-My query are:

Select "npro","nmun","cusec" from "public"."Secciones_Censales_Spain" WHERE 'NMUN' != "nmun"

+It has a result output but is wrong. It should be 41 elements not 2000000.

+This result doesn´t show the geometry:

 

the other query is:

Select "npro","nmun","cusec" from "public"."Secciones_Censales_Spain" WHERE cast (@Value(seccion) as text) = "cusec"

 

+There is a result but is wrong, It should be 41 elements but are 123 in the table. Each element is repeated 3 times.....

+geometry neither is shown.

 

 

Note:

Initiator; shapefile where field seccion (chart).

Public PostGis database; fields "npro","nmun","cusec" are shown

Public PostGis database:

 

What is wrong?

Thanks,

Juanjo


Thanks chrisatsafe for your answer,

I am triying a similar query with SQLExecutor with a same wrong result.

-the geometry exists on the feature , not on the result or rejected on SQLExecutor.

 

-My query are:

Select "npro","nmun","cusec" from "public"."Secciones_Censales_Spain" WHERE 'NMUN' != "nmun"

+It has a result output but is wrong. It should be 41 elements not 2000000.

+This result doesn´t show the geometry:

 

the other query is:

Select "npro","nmun","cusec" from "public"."Secciones_Censales_Spain" WHERE cast (@Value(seccion) as text) = "cusec"

 

+There is a result but is wrong, It should be 41 elements but are 123 in the table. Each element is repeated 3 times.....

+geometry neither is shown.

 

 

Note:

Initiator; shapefile where field seccion (chart).

Public PostGis database; fields "npro","nmun","cusec" are shown

Public PostGis database:

 

What is wrong?

Thanks,

Juanjo

What is the name of the column the geometry is held in? This will need to be included in the query


What is the name of the column the geometry is held in? This will need to be included in the query

Hi, I think this could be one of the problems. There isn´t column geometry in the PostGis database or I don´t know which is.

Yesterday I tried to use 'GeometryExtractor' in order to extract the geometry column, It does but neither shows spatial elements.

 

You said 'This will need to be included in the query', Can you show me how I can do it?

Thanks!


Try changing your query.

 

from;

Select "npro","nmun","cusec" from "public"."Secciones_Censales_Spain" WHERE 'NMUN' != "nmun"

to;

select npro ,nmun , cusec from public.secciones_censales_spain WHERE nmun != 'nmun'


Try changing your query.

 

from;

Select "npro","nmun","cusec" from "public"."Secciones_Censales_Spain" WHERE 'NMUN' != "nmun"

to;

select npro ,nmun , cusec from public.secciones_censales_spain WHERE nmun != 'nmun'

Hi,

Select "npro","nmun","cusec" from "public"."Secciones_Censales_Spain" WHERE "nmun" != 'nmun'

Either wrong result:

+Wrong table result.

+geometry neither is shown.

 

Regards,

Juanjo


Hi,

Select "npro","nmun","cusec" from "public"."Secciones_Censales_Spain" WHERE "nmun" != 'nmun'

Either wrong result:

+Wrong table result.

+geometry neither is shown.

 

Regards,

Juanjo

 

Are you using the PostGIS or the PostgreSQL as the format in the SQLCreator?

 


SQLCreator with PostGIS format

select park_type,park_name,the_geom from public.parks

 

You have to select your geometry column - in mine it is named the_geom

In FME Workbench...

 

In PGAdmin III...


Hi,

Select "npro","nmun","cusec" from "public"."Secciones_Censales_Spain" WHERE "nmun" != 'nmun'

Either wrong result:

+Wrong table result.

+geometry neither is shown.

 

Regards,

Juanjo

SQLCreator with PostGIS format

select park_type,park_name,the_geom from public.parks

 

You have to select your geometry column - in mine it is named the_geom

In FME Workbench...

 

In PGAdmin III...


SQLCreator with PostGIS format

select park_type,park_name,the_geom from public.parks

 

You have to select your geometry column - in mine it is named the_geom

In FME Workbench...

 

In PGAdmin III...

Hi,

Still isn´t working.

-PostGis database has geometry and geometry column but geometry column isn´t shown in database but it appears on Properties.

 

 

 

After run my SQL statement:

-Result is wrong but I don´t mind for the moment.

-There isn´t geometry......

 

 

I really don´t know what is happening....

 

Regards


Hi,

Still isn´t working.

-PostGis database has geometry and geometry column but geometry column isn´t shown in database but it appears on Properties.

 

 

 

After run my SQL statement:

-Result is wrong but I don´t mind for the moment.

-There isn´t geometry......

 

 

I really don´t know what is happening....

 

Regards

You have to explicitly specify the geometry column from the PostGIS table in the SQL select statement. The attribute fme_geomtry you exposed is NOT the geometry - it is the geometry type.

Please post a screen capture from PGAdmin of the table structure similar to the one I posted yesterday.

 

 

Alternatively use a PostGIS format reader or FeatureReader transformer with PostGIS format. You can specify a WHERE clause with those options too!

 


Reply