Setting up GIS

Hello,

I have been following Chapter 16. Setting up GIS of DHIS User Manual.
After download Spatial Data from http://www.diva-gis.org

Country: Mozambique

I used MapShaper to simplify geographical data according to the
described, but on Step 2 - Convert the shapefile to GML, I got stuck.
Running ogrinfo -al -so MOZ_adm1-polygons-ms1.shp the output is

INFO: Open of `MOZ_adm1-polygons-ms1.shp'
      using driver `ESRI Shapefile' successful.

Layer name: MOZ_adm1-polygons-ms1
Geometry: Polygon
Feature Count: 10
Extent: (30.217328, -26.868695) - (40.839361, -10.471250)
Layer SRS WKT:
(unknown)

Having this as an output what's the correct way to create the GML file?

Kind regards,
Paulo Grácio

···

Subject: Administrative areas (GADM)

Hi, please try

ogr2ogr -t_srs EPSG:4326 -f GML MOZ_adm1-polygons-ms1.gml MOZ_adm1-polygons-ms1.shp

···

On Tue, Feb 26, 2013 at 1:31 PM, Paulo Grácio paulogracio@gmail.com wrote:

Hello,

I have been following Chapter 16. Setting up GIS of DHIS User Manual.

After download Spatial Data from http://www.diva-gis.org

Country: Mozambique

Subject: Administrative areas (GADM)

I used MapShaper to simplify geographical data according to the

described, but on Step 2 - Convert the shapefile to GML, I got stuck.

Running ogrinfo -al -so MOZ_adm1-polygons-ms1.shp the output is

INFO: Open of `MOZ_adm1-polygons-ms1.shp’

  using driver `ESRI Shapefile' successful.

Layer name: MOZ_adm1-polygons-ms1

Geometry: Polygon

Feature Count: 10

Extent: (30.217328, -26.868695) - (40.839361, -10.471250)

Layer SRS WKT:

(unknown)

Having this as an output what’s the correct way to create the GML file?

Kind regards,

Paulo Grácio


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

Hello Jan,

thanks for the reply.

Executing the command you suggested I'm having the following error:

Can't transform coordinates, source layer has no
coordinate system. Use -s_srs to set one.

Regards,
Paulo Grácio

···

On 26 February 2013 12:53, Jan Henrik Øverland <janhenrik.overland@gmail.com> wrote:

Hi, please try

ogr2ogr -t_srs EPSG:4326 -f GML MOZ_adm1-polygons-ms1.gml
MOZ_adm1-polygons-ms1.shp

On Tue, Feb 26, 2013 at 1:31 PM, Paulo Grácio <paulogracio@gmail.com> wrote:

Hello,

I have been following Chapter 16. Setting up GIS of DHIS User Manual.
After download Spatial Data from http://www.diva-gis.org

Country: Mozambique
Subject: Administrative areas (GADM)

I used MapShaper to simplify geographical data according to the
described, but on Step 2 - Convert the shapefile to GML, I got stuck.
Running ogrinfo -al -so MOZ_adm1-polygons-ms1.shp the output is

INFO: Open of `MOZ_adm1-polygons-ms1.shp'
      using driver `ESRI Shapefile' successful.

Layer name: MOZ_adm1-polygons-ms1
Geometry: Polygon
Feature Count: 10
Extent: (30.217328, -26.868695) - (40.839361, -10.471250)
Layer SRS WKT:
(unknown)

Having this as an output what's the correct way to create the GML file?

Kind regards,
Paulo Grácio

_______________________________________________
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

Ok, then try the same command, just replace -t_srs with -s_srs.

···

On Tue, Feb 26, 2013 at 3:59 PM, Paulo Grácio paulogracio@gmail.com wrote:

Hello Jan,

thanks for the reply.

Executing the command you suggested I’m having the following error:

Can’t transform coordinates, source layer has no

coordinate system. Use -s_srs to set one.

Regards,

Paulo Grácio

On 26 February 2013 12:53, Jan Henrik Øverland > janhenrik.overland@gmail.com wrote:

Hi, please try

ogr2ogr -t_srs EPSG:4326 -f GML MOZ_adm1-polygons-ms1.gml

MOZ_adm1-polygons-ms1.shp

On Tue, Feb 26, 2013 at 1:31 PM, Paulo Grácio paulogracio@gmail.com wrote:

Hello,

I have been following Chapter 16. Setting up GIS of DHIS User Manual.

After download Spatial Data from http://www.diva-gis.org

Country: Mozambique

Subject: Administrative areas (GADM)

I used MapShaper to simplify geographical data according to the

described, but on Step 2 - Convert the shapefile to GML, I got stuck.

Running ogrinfo -al -so MOZ_adm1-polygons-ms1.shp the output is

INFO: Open of `MOZ_adm1-polygons-ms1.shp’

  using driver `ESRI Shapefile' successful.

Layer name: MOZ_adm1-polygons-ms1

Geometry: Polygon

Feature Count: 10

Extent: (30.217328, -26.868695) - (40.839361, -10.471250)

Layer SRS WKT:

(unknown)

Having this as an output what’s the correct way to create the GML file?

Kind regards,

Paulo Grácio


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

I just get the following warning message

Warning 1: Layer name 'MOZ_adm1-polygons-ms1' adjusted to
'MOZ_adm1_polygons_ms1' for XML validity. Output attached.

Nevertheless, I was expecting something similar to this structure
        (...)
  <gml:featureMember>
        <ogr:admin2 fid="F0">
            <ogr:geometryProperty>
                (...)
            </ogr:geometryProperty>
            <ogr:ADMINID>6940101</ogr:ADMINID>
            <ogr:ADM1_NAME>Southern</ogr:ADM1_NAME>
            <ogr:Name>Bo</ogr:Name>
            <ogr:ISO_CTRY>SL</ogr:ISO_CTRY>
            <ogr:POPDENS90>37</ogr:POPDENS90>
            <ogr:TOT_POP90>213</ogr:TOT_POP90>
            <ogr:ADM1CODE>69401</ogr:ADM1CODE>
            <ogr:LVLID>SLP002004000000000000</ogr:LVLID>
            <ogr:OLDLVLID>SLP002001000000000000</ogr:OLDLVLID>
        </ogr:admin2>
    </gml:featureMember>
    (...)

this is based on the test resources for dhis-service-importexport.

Paulo

MOZ_adm1-polygons-ms1.zip (144 KB)

···

On 26 February 2013 15:04, Jan Henrik Øverland <janhenrik.overland@gmail.com> wrote:

Ok, then try the same command, just replace -t_srs with -s_srs.

On Tue, Feb 26, 2013 at 3:59 PM, Paulo Grácio <paulogracio@gmail.com> wrote:

Hello Jan,

thanks for the reply.

Executing the command you suggested I'm having the following error:

Can't transform coordinates, source layer has no
coordinate system. Use -s_srs to set one.

Regards,
Paulo Grácio

On 26 February 2013 12:53, Jan Henrik Øverland >> <janhenrik.overland@gmail.com> wrote:
> Hi, please try
>
> ogr2ogr -t_srs EPSG:4326 -f GML MOZ_adm1-polygons-ms1.gml
> MOZ_adm1-polygons-ms1.shp
>
>
> On Tue, Feb 26, 2013 at 1:31 PM, Paulo Grácio <paulogracio@gmail.com> >> > wrote:
>>
>> Hello,
>>
>> I have been following Chapter 16. Setting up GIS of DHIS User Manual.
>> After download Spatial Data from http://www.diva-gis.org
>>
>> Country: Mozambique
>> Subject: Administrative areas (GADM)
>>
>> I used MapShaper to simplify geographical data according to the
>> described, but on Step 2 - Convert the shapefile to GML, I got stuck.
>> Running ogrinfo -al -so MOZ_adm1-polygons-ms1.shp the output is
>>
>> INFO: Open of `MOZ_adm1-polygons-ms1.shp'
>> using driver `ESRI Shapefile' successful.
>>
>> Layer name: MOZ_adm1-polygons-ms1
>> Geometry: Polygon
>> Feature Count: 10
>> Extent: (30.217328, -26.868695) - (40.839361, -10.471250)
>> Layer SRS WKT:
>> (unknown)
>>
>> Having this as an output what's the correct way to create the GML file?
>>
>>
>> Kind regards,
>> Paulo Grácio
>>
>> _______________________________________________
>> 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

I guess you gave the .shp and .shx files a different name (“MOZ_adm1_polygons_ms1”) instead of just replacing the original ones. Which means they are no longer linked to the rest of the shapefile set… Use the same name and

ogrinfo -al -so

should say “WGS_1984”. Then you can just do

ogr2ogr -f GML MOZ_adm1.gml MOZ_adm1.shp

and Bob’s your uncle.

···

On Tue, Feb 26, 2013 at 4:19 PM, Paulo Grácio paulogracio@gmail.com wrote:

I just get the following warning message

Warning 1: Layer name ‘MOZ_adm1-polygons-ms1’ adjusted to

‘MOZ_adm1_polygons_ms1’ for XML validity. Output attached.

Nevertheless, I was expecting something similar to this structure

    (...)

    <gml:featureMember>

    <ogr:admin2 fid="F0">

        <ogr:geometryProperty>

            (...)

        </ogr:geometryProperty>

        <ogr:ADMINID>6940101</ogr:ADMINID>

        <ogr:ADM1_NAME>Southern</ogr:ADM1_NAME>

        <ogr:Name>Bo</ogr:Name>

        <ogr:ISO_CTRY>SL</ogr:ISO_CTRY>

        <ogr:POPDENS90>37</ogr:POPDENS90>

        <ogr:TOT_POP90>213</ogr:TOT_POP90>

        <ogr:ADM1CODE>69401</ogr:ADM1CODE>

        <ogr:LVLID>SLP002004000000000000</ogr:LVLID>

        <ogr:OLDLVLID>SLP002001000000000000</ogr:OLDLVLID>

    </ogr:admin2>

</gml:featureMember>

(...)

this is based on the test resources for dhis-service-importexport.

Paulo

On 26 February 2013 15:04, Jan Henrik Øverland > janhenrik.overland@gmail.com wrote:

Ok, then try the same command, just replace -t_srs with -s_srs.

On Tue, Feb 26, 2013 at 3:59 PM, Paulo Grácio paulogracio@gmail.com wrote:

Hello Jan,

thanks for the reply.

Executing the command you suggested I’m having the following error:

Can’t transform coordinates, source layer has no

coordinate system. Use -s_srs to set one.

Regards,

Paulo Grácio

On 26 February 2013 12:53, Jan Henrik Øverland > > >> janhenrik.overland@gmail.com wrote:

Hi, please try

ogr2ogr -t_srs EPSG:4326 -f GML MOZ_adm1-polygons-ms1.gml

MOZ_adm1-polygons-ms1.shp

On Tue, Feb 26, 2013 at 1:31 PM, Paulo Grácio paulogracio@gmail.com > > >> > wrote:

Hello,

I have been following Chapter 16. Setting up GIS of DHIS User Manual.

After download Spatial Data from http://www.diva-gis.org

Country: Mozambique

Subject: Administrative areas (GADM)

I used MapShaper to simplify geographical data according to the

described, but on Step 2 - Convert the shapefile to GML, I got stuck.

Running ogrinfo -al -so MOZ_adm1-polygons-ms1.shp the output is

INFO: Open of `MOZ_adm1-polygons-ms1.shp’

  using driver `ESRI Shapefile' successful.

Layer name: MOZ_adm1-polygons-ms1

Geometry: Polygon

Feature Count: 10

Extent: (30.217328, -26.868695) - (40.839361, -10.471250)

Layer SRS WKT:

(unknown)

Having this as an output what’s the correct way to create the GML file?

Kind regards,

Paulo Grácio


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

It looks like it may have worked, but you should be careful to ensure that if you do not have a .prj file (which defines the projection information for the shape file) that you tell ogr2ogr what projection system the file is actually in. In your case, it looks like you did not need to tell ogr2ogr what the projection system was (it guess for you) , but you cannot always be sure with shape files what the projection system actually is without a bit of prior knowledge of the nature of the file, or having its metadata.

From the ogr2ogr manual…

This option controls the output projection.

-t_srs srs_def:Reproject/transform to this SRS on output

This option controls the input spatial reference system, which ogr2ogr will attempt to read from the .prj file if it is present.

If not, you may get an error like the one you say above.

-s_srs srs_def:Override source SRS

Regards,

Jason

···

On Tue, Feb 26, 2013 at 5:19 PM, Paulo Grácio paulogracio@gmail.com wrote:

I just get the following warning message

Warning 1: Layer name ‘MOZ_adm1-polygons-ms1’ adjusted to

‘MOZ_adm1_polygons_ms1’ for XML validity. Output attached.

Nevertheless, I was expecting something similar to this structure

    (...)

    <gml:featureMember>

    <ogr:admin2 fid="F0">

        <ogr:geometryProperty>

            (...)

        </ogr:geometryProperty>

        <ogr:ADMINID>6940101</ogr:ADMINID>

        <ogr:ADM1_NAME>Southern</ogr:ADM1_NAME>

        <ogr:Name>Bo</ogr:Name>

        <ogr:ISO_CTRY>SL</ogr:ISO_CTRY>

        <ogr:POPDENS90>37</ogr:POPDENS90>

        <ogr:TOT_POP90>213</ogr:TOT_POP90>

        <ogr:ADM1CODE>69401</ogr:ADM1CODE>

        <ogr:LVLID>SLP002004000000000000</ogr:LVLID>

        <ogr:OLDLVLID>SLP002001000000000000</ogr:OLDLVLID>

    </ogr:admin2>

</gml:featureMember>

(...)

this is based on the test resources for dhis-service-importexport.

Paulo

On 26 February 2013 15:04, Jan Henrik Øverland
janhenrik.overland@gmail.com wrote:

Ok, then try the same command, just replace -t_srs with -s_srs.

On Tue, Feb 26, 2013 at 3:59 PM, Paulo Grácio paulogracio@gmail.com wrote:

Hello Jan,

thanks for the reply.

Executing the command you suggested I’m having the following error:

Can’t transform coordinates, source layer has no

coordinate system. Use -s_srs to set one.

Regards,

Paulo Grácio

On 26 February 2013 12:53, Jan Henrik Øverland

janhenrik.overland@gmail.com wrote:

Hi, please try

ogr2ogr -t_srs EPSG:4326 -f GML MOZ_adm1-polygons-ms1.gml

MOZ_adm1-polygons-ms1.shp

On Tue, Feb 26, 2013 at 1:31 PM, Paulo Grácio paulogracio@gmail.com

wrote:

Hello,

I have been following Chapter 16. Setting up GIS of DHIS User Manual.

After download Spatial Data from http://www.diva-gis.org

Country: Mozambique

Subject: Administrative areas (GADM)

I used MapShaper to simplify geographical data according to the

described, but on Step 2 - Convert the shapefile to GML, I got stuck.

Running ogrinfo -al -so MOZ_adm1-polygons-ms1.shp the output is

INFO: Open of `MOZ_adm1-polygons-ms1.shp’

  using driver `ESRI Shapefile' successful.

Layer name: MOZ_adm1-polygons-ms1

Geometry: Polygon

Feature Count: 10

Extent: (30.217328, -26.868695) - (40.839361, -10.471250)

Layer SRS WKT:

(unknown)

Having this as an output what’s the correct way to create the GML file?

Kind regards,

Paulo Grácio


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

@Jan, thanks for the help, you were right, Kudos to you!

@Jason, thanks for the tip.

Kind regards,
Paulo Grácio

···

On 26 February 2013 17:25, Jason Pickering <jason.p.pickering@gmail.com> wrote:

It looks like it may have worked, but you should be careful to ensure that
if you do not have a .prj file (which defines the projection information for
the shape file) that you tell ogr2ogr what projection system the file is
actually in. In your case, it looks like you did not need to tell ogr2ogr
what the projection system was (it guess for you) , but you cannot always be
sure with shape files what the projection system actually is without a bit
of prior knowledge of the nature of the file, or having its metadata.

From the ogr2ogr manual..

This option controls the output projection.

-t_srs srs_def:Reproject/transform to this SRS on output

This option controls the input spatial reference system, which ogr2ogr will
attempt to read from the .prj file if it is present.
If not, you may get an error like the one you say above.

-s_srs srs_def:Override source SRS

Regards,
Jason

On Tue, Feb 26, 2013 at 5:19 PM, Paulo Grácio <paulogracio@gmail.com> wrote:

I just get the following warning message

Warning 1: Layer name 'MOZ_adm1-polygons-ms1' adjusted to
'MOZ_adm1_polygons_ms1' for XML validity. Output attached.

Nevertheless, I was expecting something similar to this structure
        (...)
        <gml:featureMember>
        <ogr:admin2 fid="F0">
            <ogr:geometryProperty>
                (...)
            </ogr:geometryProperty>
            <ogr:ADMINID>6940101</ogr:ADMINID>
            <ogr:ADM1_NAME>Southern</ogr:ADM1_NAME>
            <ogr:Name>Bo</ogr:Name>
            <ogr:ISO_CTRY>SL</ogr:ISO_CTRY>
            <ogr:POPDENS90>37</ogr:POPDENS90>
            <ogr:TOT_POP90>213</ogr:TOT_POP90>
            <ogr:ADM1CODE>69401</ogr:ADM1CODE>
            <ogr:LVLID>SLP002004000000000000</ogr:LVLID>
            <ogr:OLDLVLID>SLP002001000000000000</ogr:OLDLVLID>
        </ogr:admin2>
    </gml:featureMember>
    (...)

this is based on the test resources for dhis-service-importexport.

Paulo

On 26 February 2013 15:04, Jan Henrik Øverland >> <janhenrik.overland@gmail.com> wrote:
> Ok, then try the same command, just replace -t_srs with -s_srs.
>
>
> On Tue, Feb 26, 2013 at 3:59 PM, Paulo Grácio <paulogracio@gmail.com> >> > wrote:
>>
>> Hello Jan,
>>
>> thanks for the reply.
>>
>> Executing the command you suggested I'm having the following error:
>>
>> Can't transform coordinates, source layer has no
>> coordinate system. Use -s_srs to set one.
>>
>> Regards,
>> Paulo Grácio
>>
>>
>> On 26 February 2013 12:53, Jan Henrik Øverland >> >> <janhenrik.overland@gmail.com> wrote:
>> > Hi, please try
>> >
>> > ogr2ogr -t_srs EPSG:4326 -f GML MOZ_adm1-polygons-ms1.gml
>> > MOZ_adm1-polygons-ms1.shp
>> >
>> >
>> > On Tue, Feb 26, 2013 at 1:31 PM, Paulo Grácio <paulogracio@gmail.com> >> >> > wrote:
>> >>
>> >> Hello,
>> >>
>> >> I have been following Chapter 16. Setting up GIS of DHIS User
>> >> Manual.
>> >> After download Spatial Data from http://www.diva-gis.org
>> >>
>> >> Country: Mozambique
>> >> Subject: Administrative areas (GADM)
>> >>
>> >> I used MapShaper to simplify geographical data according to the
>> >> described, but on Step 2 - Convert the shapefile to GML, I got
>> >> stuck.
>> >> Running ogrinfo -al -so MOZ_adm1-polygons-ms1.shp the output is
>> >>
>> >> INFO: Open of `MOZ_adm1-polygons-ms1.shp'
>> >> using driver `ESRI Shapefile' successful.
>> >>
>> >> Layer name: MOZ_adm1-polygons-ms1
>> >> Geometry: Polygon
>> >> Feature Count: 10
>> >> Extent: (30.217328, -26.868695) - (40.839361, -10.471250)
>> >> Layer SRS WKT:
>> >> (unknown)
>> >>
>> >> Having this as an output what's the correct way to create the GML
>> >> file?
>> >>
>> >>
>> >> Kind regards,
>> >> Paulo Grácio
>> >>
>> >> _______________________________________________
>> >> 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