NOTICE: This version of the NSF Unidata web site (archive.unidata.ucar.edu) is no longer being updated.
Current content can be found at unidata.ucar.edu.

To learn about what's going on, see About the Archive Site.

Re: [netcdf-hdf] NetCDF to ShapeFile

NOTE: The netcdf-hdf mailing list is no longer active. The list archives are made available for historical reasons.

Hi Hal Finkel,

Thank you for your answer.
I finally succeed to transform my data.
As you told me I use gdal-ogr to create the final ShapeFile.

Regards

Arnaud

On Thu, Nov 12, 2009 at 7:37 PM, Hal Finkel <hal.finkel@xxxxxxxx> wrote:

> Arnaud,
>
> Take a look at the GDAL OGR library:
>
> http://www.gdal.org/
> http://www.gdal.org/ogr/
>
> which has python bindings. This link has installation instructions and
> links to a python-based tutorial:
>
> http://trac.osgeo.org/gdal/wiki/GdalOgrInPython
>
>  -Hal
>
> Arnaud Vandecasteele wrote:
>
>> Hi all,
>>
>> I would like to know if it's possible to read data from a netcdf file and
>> export it into a EsriShapefile File. The ShapeFile i a common file format in
>> the GIS World.
>> I'm trying to get the latitude, longitude and a determinate value of a
>> netcdf file. But I don't know exactly how to do it.
>> I succeed to open and read a netcdf file in python but i don't know how to
>> export the data.
>> Here is my simple script :
>>
>> import Scientific.IO.NetCDF as nc
>> from Numeric import *
>> import sys
>>
>> try :
>>    ncFile = nc.NetCDFFile("tos_O1_2001-
>> 2002.nc <http://2002.nc>","r")
>>
>> except :
>>    print "can't open the file"
>>    sys.exit(1)
>>
>> try :
>>    print "################# Dimensions #################"
>>    print ncFile.dimensions.keys()
>>
>>    print "################# Variables #################"
>>    print ncFile.variables.keys()
>>    #return ['time_bnds', 'lat_bnds', 'lon', 'lon_bnds', 'time', 'lat',
>> 'tos'
>>
>>    print "################# Var Dim #################"
>>    tos = ncFile.variables["tos"]
>>    print tos.dimensions
>>    #return : ('time', 'lat', 'lon')
>>
>>
>>    tosValue = tos.getValue()
>>
>> except :
>>    ncFile.close()
>>
>>
>> I also tried to use the *ncdump* and *ncks* utilities and I've been able
>> to get a TXT file of the data but i can't use directly to transform them in
>> shapefile.
>>
>> Do you know how I could do that?
>>
>>
>> Best regards
>>
>>
>> ------------------------------------------------------------------------
>>
>> _______________________________________________
>> netcdf-hdf mailing list
>> netcdf-hdf@xxxxxxxxxxxxxxxx
>> For list information or to unsubscribe, visit:
>> http://www.unidata.ucar.edu/mailing_lists/
>>
>


-- 
--------------------------------------------------------------------
Van De Casteele Arnaud
Mines Paris Tech - CRC
Sophia-Antipolis
0698 24 25 29
SIG - WebMapping - SOLAP - BI
Web Site : http://geotribu.net/
  • 2009 messages navigation, sorted by:
    1. Thread
    2. Subject
    3. Author
    4. Date
    5. ↑ Table Of Contents
  • Search the netcdf-hdf archives: