Issue with gml file map data import

Hi,

During my map data import (via gml file), I have encountered an issues.

If name length in gml file is longer than 50 character, the import process would throw an error.

This is not the intended behavior, right?

Hi James,

this issue is a bit awkward. Many places we need a short (e.g. 50 char long) org unit name to fit in reports, charts. Now on import from external sources this might now be available. Previously the org unit shortname field was unique so we could not simply cut off the name at the 50th char. Now it is no longer unique so that could be an option.

As an immediate workaround you can set the max-length of shortname to 50 directly in the database. After the import you can deal with this manually with SQL, e.g. using the psql substring feature to use only the 50 first chars, or whatever you prefer.

http://www.postgresql.org/docs/9.1/static/functions-string.html

regards,

Lars

···

On Sat, Mar 2, 2013 at 12:21 PM, ChangJames jamesbjchang@hotmail.com wrote:

Hi,

During my map data import (via gml file), I have encountered an issues.

If name length in gml file is longer than 50 character, the import process would throw an error.

This is not the intended behavior, right?


Mailing list: https://launchpad.net/~dhis2-users

Post to : dhis2-users@lists.launchpad.net

Unsubscribe : https://launchpad.net/~dhis2-users

More help : https://help.launchpad.net/ListHelp

Just checked the transform and verified what Lars has said. Currently we just populate both name and shortname with the name from the gml, which will cause an error on importing.

Its easy enough to fix the transform. I think (haven’t tested this for a while) that you can even put a patched version of gml2dxf.xsl into a “transform” directory under your DHIS2_HOME and it will pick that one up in preference to the builtin one. You will probably have to create the transform directory. I’ve attached a version you can try out which truncates the short names if necessary - place this file under $DHIS2_HOME/transforms and try again.

Bob

gml2dxf.xsl (1.78 KB)

···

On 4 March 2013 07:34, Lars Helge Øverland larshelge@gmail.com wrote:

Hi James,

this issue is a bit awkward. Many places we need a short (e.g. 50 char long) org unit name to fit in reports, charts. Now on import from external sources this might now be available. Previously the org unit shortname field was unique so we could not simply cut off the name at the 50th char. Now it is no longer unique so that could be an option.

As an immediate workaround you can set the max-length of shortname to 50 directly in the database. After the import you can deal with this manually with SQL, e.g. using the psql substring feature to use only the 50 first chars, or whatever you prefer.

http://www.postgresql.org/docs/9.1/static/functions-string.html

regards,

Lars

On Sat, Mar 2, 2013 at 12:21 PM, ChangJames jamesbjchang@hotmail.com wrote:

Hi,

During my map data import (via gml file), I have encountered an issues.

If name length in gml file is longer than 50 character, the import process would throw an error.

This is not the intended behavior, right?


Mailing list: https://launchpad.net/~dhis2-users

Post to : dhis2-users@lists.launchpad.net

Unsubscribe : https://launchpad.net/~dhis2-users

More help : https://help.launchpad.net/ListHelp


Mailing list: https://launchpad.net/~dhis2-users

Post to : dhis2-users@lists.launchpad.net

Unsubscribe : https://launchpad.net/~dhis2-users

More help : https://help.launchpad.net/ListHelp