[Gvsig_english] gvSIG 1.1.2 and 1.9 (1245): Can't load postgis-layer

Johannes Valenta spatialjoe at googlemail.com
Wed Oct 14 11:53:13 CEST 2009


Hi Fran,

many thanks for sheding some light on how gvSIG reads PostGIS geometry
types.
Yesterday I used the PostGIS function ST_DUMP to "explode" all multilines to
create a nice Linestring layer ( I  do need simple lines for analysis
purposes anyway) et voila! gvSIG lets me choose the geometry column from the
listbox and nicely shows all the simple lines.
I like it!
My problem resulted from not being picky about Multipolygons in the very
beginning as I clipped lines with those polygons within PostGIS. So I
produced multilines and lines as well which then caused the troubles in
displaying them in gvSIG.
Exporting this layer to shp file directly from PostGIS produced LINE2D as
geometry type which was perfectly read by gvSIG concealing my inaccurateness
** <http://dict.leo.org/ende?lp=ende&p=5tY9AA&search=inaccurateness>.
"Remember to think twice" as  Jacko used to sing [?]

Thanks again!

Johannes

2009/10/14 Francisco José Peñarrubia <fjp at scolab.es>

>  Hi Johannes.
>
> The supported geometry types in PostGIS gvSIG's drivers are:
>
>         case POINT2D:
>             aux = "*POINT*";
>             break;
>         case LINE2D:
>             aux = "*MULTILINESTRING*";
>             break;
>         case POLYGON2D:
>             aux = "*MULTIPOLYGON*";
>             break;
>         case MULTI2D:
>             aux = "*GEOMETRY*";
>             break;
>         case MULTIPOINT:
>             aux = "*MULTIPOINT*";
>             break;
>
>
> If you need to mix LINESTRING and MULTILINESTRING, I advice you to set
> geometry type to MULTILINESTRING always, although GEOMETRY will be ok also,
> but then your layer will be treated like a DXF, DGN or DWG (multiple types
> of geometries).
> More info about adding geometry columns in PostGIS:
> http://postgis.refractions.net/documentation/manual-1.3/ch06.html
> (You can try this function: Probe_Geometry_Columns()).
>
> But I think this shouldn't be the problem. What is the name of your layer?.
> The code to select geometry fields in Postgis gvSIG driver is this:
>
>          String[] tokens = table_name.split("\\u002E", 2);
>         String sql;
>         if (tokens.length > 1)
>         {
>             sql = "select * from GEOMETRY_COLUMNS WHERE F_TABLE_SCHEMA = '"
>                  + tokens[0] + "' AND F_TABLE_NAME = '" +
>             tokens[1] + "'";
>         }
>         else
>         {
>             sql = "select * from GEOMETRY_COLUMNS" +
>             " where F_TABLE_SCHEMA = current_schema() AND F_TABLE_NAME = '"
> + table_name + "'";
>
>         }
>
>         ResultSet rs = stAux.executeQuery(sql);
>         while (rs.next())
>         {
>             String geomCol = rs.getString("F_GEOMETRY_COLUMN");
>             list.add(geomCol);
>         }
>         rs.close(); stAux.close();
>
>
>
> This means that you can't use the character "." (period) in your table
> name. Otherwise, it will be treated as your schema (for example,
> public.tablename).
>
> Hopes it helps. Please, if you find the problem, let us know... I'm curious
> :-)
>
> Fran Peñarrubia
> www.scolab.es
>
>
> Johannes Valenta escribió:
>
> Hi list,
>
> after examining my postgis-layer more carefully I found out that I mixed up
> Linestrings and Multilinestrings.
> This probably caused all the trouble as gvSIG does not know how to handle
> this mix.
> Well, I am cleaning my layer...
> Thanks all!
>
> Johannes
>
> 2009/10/13 Johannes Valenta <spatialjoe at googlemail.com>
>
>> Hi Fran, hi Vladimir,
>>
>> thanks for the input.
>> I think Fran is right with changing the fieldname "length" to something
>> else.
>> I ruled out any typos and also the table name should be no problem.
>> My server is not public and I will have a look at my database in the
>> evening.
>>  Regarding the geometry_columns table in Postgis everthing is fine.
>>
>>  Many thanks so far,
>>
>> Johannes
>>  2009/10/13 Vladimir Peric <vladimir.peric at beogis.com>
>>
>>> Hi,
>>>
>>> I had the same problem and here is what solved the problem in my case. In
>>> order GvSig to recognize the table as a layer candidate, there should exist
>>> a table in PostreSQL, named *geometry_columns*. For each table in the
>>> database that has a geometry column, a corresponding row in the table *
>>> geometry_columns* should be present. The row in this table can be
>>> manually added if needed.
>>>
>>> Hope this will help.
>>>
>>> Cheers,
>>> Vladimir
>>>
>>>
>>>
>>>
>>> On Tue, Oct 13, 2009 at 9:22 AM, Johannes Valenta <
>>> spatialjoe at googlemail.com> wrote:
>>>
>>>> Hi Virginia,
>>>> thank you for responding. I am not able to choose the geometry column
>>>> within the listbox - it just stays blank. That's the problem.
>>>> What could be the reason?
>>>>  Best,
>>>>
>>>> Johannes
>>>>
>>>>  2009/10/13 virginia morales segura <morales_vir at gva.es>
>>>>
>>>>> Hi Johannes,
>>>>>
>>>>> you must can to choose your geometry column at listbox of geometry. If
>>>>> you say that you have the column type geometry, you should choose it.
>>>>> Can you send us the layer that goes wrong.
>>>>>
>>>>> Regards.
>>>>>
>>>>>
>>>>> Johannes Valenta escribió:
>>>>>  > Hi list,
>>>>> >
>>>>> > today I encountered a strange phenomenon. I tried to load a
>>>>> > postgis-layer into projects of both versions (1.1.2, 1.9 build1245)
>>>>> > which did not work.
>>>>> > In both versions the geometry column would not show up in the
>>>>> > corresponding field although I registered the layer in the "geometry
>>>>> > columns" table in postgis as usual.
>>>>> > All other layers within my database work fine.
>>>>> > These are the columns of my layer:
>>>>> >   pid integer,
>>>>> >   highway text,
>>>>> >   tracktype text,
>>>>> >   label3 text,
>>>>> >   belag numeric,
>>>>> >   wegbreite numeric,
>>>>> >   landnutz numeric,
>>>>> >   length double precision,
>>>>> >   the_geom geometry,
>>>>> >   summe integer,
>>>>> >   pid1 serial NOT NULL
>>>>> >
>>>>> > Exporting the layer from postgis to shp and adding it to gvSIG works
>>>>> > (so I obviously did not mess up the geometry type).
>>>>> > Any ideas /hints?
>>>>> >
>>>>> > Best,
>>>>> >
>>>>> > Johannes
>>>>>  >
>>>>> ------------------------------------------------------------------------
>>>>> >
>>>>> > _______________________________________________
>>>>> > Gvsig_internacional mailing list
>>>>> > Gvsig_internacional at listserv.gva.es
>>>>> > http://listserv.gva.es/cgi-bin/mailman/listinfo/gvsig_internacional
>>>>> >
>>>>>
>>>>> _______________________________________________
>>>>> Gvsig_internacional mailing list
>>>>> Gvsig_internacional at listserv.gva.es
>>>>> http://listserv.gva.es/cgi-bin/mailman/listinfo/gvsig_internacional
>>>>>
>>>>
>>>>
>>>> _______________________________________________
>>>> Gvsig_internacional mailing list
>>>> Gvsig_internacional at listserv.gva.es
>>>> http://listserv.gva.es/cgi-bin/mailman/listinfo/gvsig_internacional
>>>>
>>>>
>>>
>>>
>>>  --
>>> Vladimir Perić
>>> General Manager
>>> BEOGIS d.o.o. Beograd
>>> Milutina Milankovića 130/109, Novi Beograd
>>>
>>> mob:   +381642040889
>>> tel:      +381112122810
>>> mail:    vladimir.peric at beogis.com
>>> skype: vlada.peric
>>> site:     www.beogis.com
>>>
>>> _______________________________________________
>>> Gvsig_internacional mailing list
>>> Gvsig_internacional at listserv.gva.es
>>> http://listserv.gva.es/cgi-bin/mailman/listinfo/gvsig_internacional
>>>
>>>
>>
> ------------------------------
>
> _______________________________________________
> Gvsig_internacional mailing listGvsig_internacional at listserv.gva.eshttp://listserv.gva.es/cgi-bin/mailman/listinfo/gvsig_internacional
>
>
>
> _______________________________________________
> Gvsig_internacional mailing list
> Gvsig_internacional at listserv.gva.es
> http://listserv.gva.es/cgi-bin/mailman/listinfo/gvsig_internacional
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://listserv.gva.es/pipermail/gvsig_internacional/attachments/20091014/c41480bf/attachment.htm 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: image/png
Size: 611 bytes
Desc: not available
Url : http://listserv.gva.es/pipermail/gvsig_internacional/attachments/20091014/c41480bf/attachment.png 


More information about the Gvsig_internacional mailing list