← Back to team overview

dhis2-devs team mailing list archive

Re: [Branch ~dhis2-devs-core/dhis2/trunk] Rev 1887: Added latitude, longitude, polygoncoordinates to dxf

 

On Wed, May 19, 2010 at 11:50 AM,  <noreply@xxxxxxxxxxxxx> wrote:
> ------------------------------------------------------------
> revno: 1887
> committer: Lars <larshelg@larshelg-laptop>
> branch nick: trunk
> timestamp: Wed 2010-05-19 11:48:29 +0200
> message:
>  Added latitude, longitude, polygoncoordinates to dxf

Happy to see this. I have been thinking that we don't really need
latitude and longitude when we have the coordinates, but that we need
a type field instead. The reason is that for GeoJSON generation we
need to support POINT, POLYGON and MULTIPOLYGON, and it make sense to
have these directly in the database. I have been experimenting a bit
with this lately, and it works great, but I was forced to store the
type in the geocode field.

That being said, we may also consider having more than one coordinate
field, for different levels of detail, though I'm afraid that can
easily get messy.

Knut



> modified:
>  dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dxf/converter/OrganisationUnitConverter.java
>  dhis-2/dhis-support/dhis-support-jdbc/src/main/java/org/hisp/dhis/jdbc/batchhandler/OrganisationUnitBatchHandler.java
>
>
> --
> lp:dhis2
> https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk
>
> Your team DHIS 2 developers is subscribed to branch lp:dhis2.
> To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription
>
> === modified file 'dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dxf/converter/OrganisationUnitConverter.java'
> --- dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dxf/converter/OrganisationUnitConverter.java        2010-04-12 21:23:33 +0000
> +++ dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dxf/converter/OrganisationUnitConverter.java        2010-05-19 09:48:29 +0000
> @@ -65,6 +65,9 @@
>     private static final String FIELD_ACTIVE = "active";
>     private static final String FIELD_COMMENT = "comment";
>     private static final String FIELD_GEO_CODE = "geoCode";
> +    private static final String FIELD_POLYGON_COORDINATES = "polygonCoordinates";
> +    private static final String FIELD_LATITUDE = "latitude";
> +    private static final String FIELD_LONGITUDE = "longitude";
>     private static final String FIELD_LAST_UPDATED = "lastUpdated";
>
>     // -------------------------------------------------------------------------
> @@ -123,6 +126,9 @@
>                 writer.writeElement( FIELD_ACTIVE, String.valueOf( unit.isActive() ) );
>                 writer.writeElement( FIELD_COMMENT, unit.getComment() );
>                 writer.writeElement( FIELD_GEO_CODE, unit.getGeoCode() );
> +                writer.writeElement( FIELD_POLYGON_COORDINATES, unit.getPolygonCoordinates() );
> +                writer.writeElement( FIELD_LATITUDE, unit.getLatitude() );
> +                writer.writeElement( FIELD_LONGITUDE, unit.getLongitude() );
>                 writer.writeElement( FIELD_LAST_UPDATED, DateUtils.getMediumDateString( unit.getLastUpdated(), EMPTY ) );
>
>                 writer.closeElement();
> @@ -150,6 +156,9 @@
>             unit.setActive( Boolean.parseBoolean( values.get( FIELD_ACTIVE ) ) );
>             unit.setComment( values.get( FIELD_COMMENT ) );
>             unit.setGeoCode( values.get( FIELD_GEO_CODE ) );
> +            unit.setPolygonCoordinates( values.get( FIELD_POLYGON_COORDINATES ) );
> +            unit.setLatitude( values.get( FIELD_LATITUDE ) );
> +            unit.setLongitude( values.get( FIELD_LONGITUDE ) );
>             unit.setLastUpdated( DateUtils.getMediumDate( values.get( FIELD_LAST_UPDATED ) ) );
>
>             NameMappingUtil.addOrganisationUnitMapping( unit.getId(), unit.getName() );
>
> === modified file 'dhis-2/dhis-support/dhis-support-jdbc/src/main/java/org/hisp/dhis/jdbc/batchhandler/OrganisationUnitBatchHandler.java'
> --- dhis-2/dhis-support/dhis-support-jdbc/src/main/java/org/hisp/dhis/jdbc/batchhandler/OrganisationUnitBatchHandler.java       2010-04-12 21:23:33 +0000
> +++ dhis-2/dhis-support/dhis-support-jdbc/src/main/java/org/hisp/dhis/jdbc/batchhandler/OrganisationUnitBatchHandler.java       2010-05-19 09:48:29 +0000
> @@ -95,6 +95,7 @@
>         statementBuilder.setColumn( "active" );
>         statementBuilder.setColumn( "comment" );
>         statementBuilder.setColumn( "geocode" );
> +        statementBuilder.setColumn( "polygoncoordinates" );
>         statementBuilder.setColumn( "latitude" );
>         statementBuilder.setColumn( "longitude" );
>         statementBuilder.setColumn( "lastUpdated" );
> @@ -113,6 +114,7 @@
>         statementBuilder.setValue( unit.isActive() );
>         statementBuilder.setValue( unit.getComment() );
>         statementBuilder.setValue( unit.getGeoCode() );
> +        statementBuilder.setValue( unit.getPolygonCoordinates() );
>         statementBuilder.setValue( unit.getLatitude() );
>         statementBuilder.setValue( unit.getLongitude() );
>         statementBuilder.setValue( unit.getLastUpdated() );
>
>
> _______________________________________________
> Mailing list: https://launchpad.net/~dhis2-devs
> Post to     : dhis2-devs@xxxxxxxxxxxxxxxxxxx
> Unsubscribe : https://launchpad.net/~dhis2-devs
> More help   : https://help.launchpad.net/ListHelp
>
>



-- 
Cheers,
Knut Staring



Follow ups

References