tehamalab / gdal2tiles

A python library for generating map tiles based on gdal2tiles.py from GDAL project
http://gdal2tiles.rtfd.io/
MIT License
86 stars 32 forks source link

AttributeError: module 'gdal2tiles' has no attribute 'generate_tiles' #7

Open meteoDaniel opened 5 years ago

meteoDaniel commented 5 years ago

Description

generate_tiles function is missing. I am using pycharm, the IDE is referencing to the right function but calling the script within a ipython script in virtual env it is missing.

What I Did

import gdal2tiles
gdal2tiles.generate_tiles(map_file, tile_dir, zoom='3-12')
machakux commented 5 years ago

@meteoDaniel I guess you have a typo in your script

It should be gdal2tiles.generate_tiles. You have a missing s, you used gdal2tile which could be a different module.

meteoDaniel commented 5 years ago

@machakux thanks, but it was just a spelling mistake in this issue. Error still occures.

machakux commented 5 years ago

@meteoDaniel I couldn't reproduce this issue on my system.

May be you should make sure the package is properly installed (without errors) or you don't have other conflicting packages. You can try reinstalling on a fresh virtualenv.

For me gdal2tiles.generate_tiles is recogized as a function (no AttributeError is raised). gdal2tiles func

aidankinzett commented 5 years ago

I'm also experiencing this issue, importing it in the console seems to work, but using it with celery it says that it has no attribute generate_tiles

aidankinzett commented 5 years ago

I was on GDAL version 2.3, downgraded to 2.2.3 and now its working

ATNC commented 4 years ago

Does anybody know how to fix this?

joaquinbentancor commented 4 years ago

I have the same problem. Someone know how to fix this?

machakux commented 4 years ago

I tried testing with multiple versions of GDAL (including GDAL 2.3.3) and I was unable to reproduce this issue, neither locally nor on Travis.

Basic tests performed are included in tests/ directory (https://github.com/tehamalab/gdal2tiles/blob/master/tests/test_generate_tiles.py) and passing Travis tests with multiple versions of GDAL can be seen at https://travis-ci.org/github/tehamalab/gdal2tiles

My guess is this issue is caused by errors during installation or a conficts in package names.

Unless someone can reproduce this issue on a fresh environment and provide a test script or expicit steps to reproduce this issue, I think this issue can be closed.

ashnair1 commented 3 years ago

Don't know about the lower versions but on 3.1.4 (and probably up), GDAL has a gdal2tiles.py and this creates a conflict. In my case, it opts for

'/home/ashwin/miniconda3/envs/rdet/lib/python3.7/site-packages/GDAL-3.1.4-py3.7-linux-x86_64.egg-info/scripts/gdal2tiles.py'

instead of

/home/ashwin/miniconda3/envs/rdet/lib/python3.7/site-packages/gdal2tiles/gdal2tiles.py

The one from GDAL does not have a generate_tiles function.

machakux commented 3 years ago

It seems GDAL now includes gdal2tiles.py script in its pypi package as @ashnair1 mentioned. Perhaps this package should be renamed to avoid conflicts.

What are other options?

HelgeDavidSchneider commented 2 years ago

+1 for renaming this package to avoid import problems when GDAL is installed as well.

mdenno-rti commented 2 years ago

We are experiencing this too. Vote for renaming package.

simonrp84 commented 2 years ago

Likewise, am experiencing the same issue.