Opened 20 years ago
Last modified 20 years ago
#591 closed defect (fixed)
PG/OGR and OGDI issues - recent patch
Reported by: | Markus Neteler | Owned by: | warmerdam |
---|---|---|---|
Priority: | high | Milestone: | |
Component: | OGR_SF | Version: | unspecified |
Severity: | normal | Keywords: | |
Cc: |
Description
Frank, > >Briefly: The OGDI driver reports the VMAP0 'nam' field with > >length of 64 chars, but delivers some strings in EURASIA > >with > 64 chars. Subsequently the PG driver fails. This was "fixed" by a patch to the PG driver, trimming the values to the column length. On Fri, Jul 09, 2004 at 12:41:18PM -0400, Frank Warmerdam wrote: > I'm a little nervous about this fix. First, I am not positive that the > width is always set in a meaningful way for the PG driver. Second, I am > nervous about truncating data without at least warning the user. Third, > I feel the real bug is in the OGDI driver and should be fixed there. > I sure wish the damn bugzilla was working so I could file this bug > there and return to it. Given that I can't, I think I will just apply > your patch despite my misgivings. Unfortunatelty this patch introduces a new problem: The new cast fills the strings with trailing blanks so that e.g. MapServer now print all labels shifted (as it prints the white space as well). Example: http://grass.itc.it/cgi-bin/mapserv?mode=browse&imgxy=250+250&imgext=10.132772+44.916805+12.500524+47.286189&imgbox=-1+-1+-1+-1&map=%2Fvar%2Fwww%2Fmap-script%2Fmapserverjs_vmap0_postgis.map&rawminx=10.132772&rawminy=44.916805&rawmaxx=12.500524&rawmaxy=47.286189&layer=coastl&layer=roadl&layer=railrdl&layer=watrcrsl&layer=inwatera&layer=builtupa&layer=oceansea&layer=elevation&mode=browse&zoom=1&mapsize=600+600&scale=&varscale=2071666.506602&mapxy=&map_resolution=100 (lake labels heavily shifted to west as white space appears right to the text) Using a trim() maybe cures it. But it would be better not to allow OGDI to send strings longer than the definition. Might this be fixed in OGDI or the OGR/OGDI driver... So you probably want to revert that change in ogrpgtablelayer.cpp or add the SQL trim() function to get rid of the blanks introduced by the typecast. Example: SELECT nam::varchar(6)||'end' from builtupa_eurnasia ; ?column? ----------- HAMMERend BATSFOend VADSO end ^-- undesired blank(s) inserted up to the length of the column But: SELECT trim(nam::varchar(6))||'end' from builtupa_eurnasia ; ?column? ----------- HAMMERend BATSFOend VADSOend ^-- looks much better Best regards Markus Neteler
Note:
See TracTickets
for help on using tickets.