[ncl-talk] Import shapefile into NCL 6.2
Dave Allured - NOAA Affiliate
dave.allured at noaa.gov
Thu Mar 25 12:19:48 MDT 2021
All,
For future reference, there already is the potential to read KMZ/KML
directly in NCL. The GDAL library is used under the hood to read
shapefiles, and GDAL can also read KML and a bunch of other vector
formats. GDAL presents a common interface. To read KMZ/KML and other
formats would require some NCL source code work by NCAR support staff, or a
talented volunteer.
On Thu, Mar 25, 2021 at 11:37 AM Dave Allured - NOAA Affiliate <
dave.allured at noaa.gov> wrote:
> KMZ is a shape format, but it is different than the official ESRI
> shapefile format. The official format has *.shp* suffix, not *.kmz*, and
> the shapefile also has at least two companion files with alternate
> suffixes. Please see the introduction at the top of NCL's shapefile page:
>
> https://www.ncl.ucar.edu/Applications/shapefiles.shtml
>
> KMZ can be handled by NCL with quite a lot of tricky programming. Your
> easiest solution would be to go back to gadm.org or some other source,
> and download shapefile format, not KMZ. I hope this helps.
>
> If anyone else has a KMZ or KML reader function for NCL, please mention
> it. This would be a good addition to NCL.
>
>
> On Thu, Mar 25, 2021 at 10:49 AM G.Monte--- via ncl-talk <
> ncl-talk at mailman.ucar.edu> wrote:
>
>> Dear NCL users,
>>
>> I would like to import a shapefile into my NCL code, in order to have the
>> regional (and possibly provincial) suddivision of Italy.
>>
>> First, I tried with the KMZ level-2 "gadm36_ITA_2.kmz" available in
>> www.gadm.org. Once I imported this file into my code, set lnres=True with
>> its options and typed:
>>
>> id = gsn_add_shapefile_polylines(wks,map,"gadm36_ITA_2.kmz",lnres)
>>
>> I get this error message:
>>
>> warning:_NclOpenFile: Can not open file <gadm36_ITA_2.kmz>; file format
>> not supported or file is corrupted
>> warning:isfilevar: undefined file returning missing value
>>
>> What does it mean properly? It's the first time I have ever tried this, so
>> I could get wrong easily.
>>
>> Thanks in advance,
>> Giulio Monte
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.ucar.edu/pipermail/ncl-talk/attachments/20210325/f636c679/attachment.html>
More information about the ncl-talk
mailing list