matplotlib / matplotlib/basemap

readshapefile fails on certain filenames

未关闭
#151 7 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

主要语言
Python
星标
817
派生
395
PR 合并指标
30 天内没有已合并 PR

描述

Hi,

(Tested with basemap 1.0.6)

This works:

`m.readshapefile('foo.shp', 'my_shape')`

while this fails:

`m.readshapefile('bar_0.1.shp', 'my_shape')`

```
raise IOError('error reading shapefile %s.shp' % shapefile)
fields = shf.fields
coords = []; attributes = []

IOError: error reading shapefile bar_0.1.shp
```

Note that foo.shp and bar_0.1.shp are exactly the same file except for the filename. So it seems that the additional `.` causes the problem. Minimal example to reproduce behavior:

Rename `huralll020.{shp,dfb,shx}` to `huralll020_0.1.{shp,dbf,shx}` and change filename in `examples/hurrtracks.py` accordingly. Run hurrtracks.py.

Of course the obvious workaround is not to use `.` in filenames. But this is somewhat impracticable as I have a large number or files and would like keeping the filenames consistent accross filetypes (netCDF, shapfiles, pngs, etc).

Is there an easy fix?

Thanks very much,

Andy

贡献指南

这个仓库没有索引到贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

调研方向

从 readshapefile 入口点以及 examples/hurrtracks.py 中的复现开始。按照描述重命名 huralll020 的 shapefile 组件,运行 hurrtracks.py,并跟踪带点的文件名失败的原因。当同一个 shapefile 可以使用类似 huralll020_0.1 的文件名读取,且现有示例仍然正常工作时,即表示完成。

由索引模型根据 Issue 内容生成。

评估

技术栈
python
领域
data
Issue 类型
缺陷
难度
2/5
预计耗时
1-3 小时
活跃度
停滞
描述清晰度
基本清楚
新手友好度
45/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。