ecometrica / gdal2mbtiles

Converts a GDAL-readable dataset into an MBTiles file. This is used to generate web maps.
Apache License 2.0
165 stars 27 forks source link

ImportError: No module named vipsCC.VError #7

Closed LeonanCarvalho closed 6 years ago

LeonanCarvalho commented 7 years ago

I got this erro when install it using pip. on CentOS7


Traceback (most recent call last):
  File "/usr/bin/gdal2mbtiles", line 11, in <module>
    sys.exit(main())
  File "/usr/lib/python2.7/site-packages/gdal2mbtiles/main.py", line 242, in main
    args = parse_args(args=args)
  File "/usr/lib/python2.7/site-packages/gdal2mbtiles/main.py", line 209, in parse_args
    args.coloring = coloring_arg(args.coloring)
  File "/usr/lib/python2.7/site-packages/gdal2mbtiles/main.py", line 65, in coloring_arg
    from gdal2mbtiles import vips
  File "/usr/lib/python2.7/site-packages/gdal2mbtiles/vips.py", line 36, in <module>
    from vipsCC.VError import VError
ImportError: No module named vipsCC.VError
joharohl commented 7 years ago

As per the documentation vipsCC is not installable via pip. Neither is gdal.

yum install vips-python gdal-python should work, but I'm not a CentOS user, so can't promise too much. Maybe somone else can advice?

LeonanCarvalho commented 7 years ago

I already had all the other requirements installed, however I did not mind the vps.

To install it on CentOS (fedora, red hat etc) you should use remi repository:

Download the latest remi-release rpm from http://rpms.famillecollet.com/enterprise/7/remi/x86_64/ Install remi-release rpm: rpm -Uvh remi-release*rpm Install vips-python rpm package: yum --enablerepo=remi install vips-python

joharohl commented 7 years ago

Cool that it worked out.

If you want/have time to, we would love a PR of the steps necessary on a red hat based system to the Readme. We are kind of ubuntu people over here, so it would be great to get it from someone that knows the system.

LeonanCarvalho commented 7 years ago

As soon as I had a positive return of the installation I contribute to your project, however there are still problems:


Traceback (most recent call last):
  File "/usr/bin/gdal2mbtiles", line 11, in <module>
    sys.exit(main())
  File "/usr/lib/python2.7/site-packages/gdal2mbtiles/main.py", line 283, in main
    colors=colors, band=band)
  File "/usr/lib/python2.7/site-packages/gdal2mbtiles/helpers.py", line 199, in warp_mbtiles
    zoom_offset=zoom_offset)
  File "/usr/lib/python2.7/site-packages/gdal2mbtiles/helpers.py", line 67, in image_mbtiles
    pyramid = preprocessor(**locals())
  File "/usr/lib/python2.7/site-packages/gdal2mbtiles/helpers.py", line 303, in upsample_after_warp
    resolution = pyramid.dataset.GetNativeResolution()
  File "/usr/lib/python2.7/site-packages/gdal2mbtiles/gdal.py", line 478, in GetNativeResolution
    dst_ref = self.GetSpatialReference()
  File "/usr/lib/python2.7/site-packages/gdal2mbtiles/gdal.py", line 446, in GetSpatialReference
    sr = sr.FromEPSG(sr.GetEPSGCode())
  File "/usr/lib/python2.7/site-packages/gdal2mbtiles/gdal.py", line 780, in FromEPSG
    s.ImportFromEPSG(code)
  File "/usr/lib64/python2.7/site-packages/osgeo/osr.py", line 683, in ImportFromEPSG
    return _osr.SpatialReference_ImportFromEPSG(self, *args)
TypeError: in method 'SpatialReference_ImportFromEPSG', argument 2 of type 'int'

any try?

joharohl commented 7 years ago

I was able to reproduce your problem.

It's most likely due to that when installing gdal on Centos 7, you get a newer version than most other distributions. Something is not working properly because of that (as far as we can tell). Someone will have a look at it, but I can't promise when.

In the meantime, you should be able to work around it by warping the input file to whatever projection you want (for webbased maps it's usually EPSG:3857) and telling gdal2mbtiles to use the specific projection, thus skipping the warp step like so: gdal2mbtiles --spatial-reference 3857 <input> <output>.

Also, if you have access to a system running a debian based system, it should work out of the box.

Hope this helps and thanks for your interest in gdal2mbtiles.