Giter VIP home page Giter VIP logo

greenwich's People

Contributors

bkg avatar brunosmartin avatar postfalk avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

greenwich's Issues

Version GDAL dependency?

Moved from bkg/django-spillway#4,

/cc @postfalk

@postfalk originally inquired:

PyPi now provides GDAL 1.11.0 which breaks on the currently installed libgdal. Could we freeze it to 1.10.0 to make it work across installations for now? Or should we rework all the deployment scripts (rather not since I am pretty confused by the whole libgdal/libgdal1 packaging stuff, particular on 12.04).

OverflowError: math range error

I get this error when I run django-spillway tests in the configuration specified below.

(env)falk@falk:~/projects/django-spillway/django-spillway$ pip freeze
Django==1.6.5
GDAL==1.11.1
Pillow==2.6.1
argparse==1.2.1
djangorestframework==2.3.14
greenwich==0.3.0
numpy==1.9.1
wsgiref==0.1.2
(env)falk@falk:~/projects/django-spillway/django-spillway$ python runtests.pyCreating test database for alias 'default'...
...........................{"count": 2, "previous": null, "type": "FeatureCollection", "features": [{"geometry": {"type": "Point", "coordinates": [-100.0, 30.0]}, "type": "Feature", "properties": {"name": "point_1"}, "id": 1}, {"geometry": {"type": "Point", "coordinates": [-121.0, 31.0]}, "type": "Feature", "properties": {"name": "point_2"}, "id": 2}], "next": null}
....E.......................................
======================================================================
ERROR: test_not_existing_tile_coords (tests.test_views.TileViewTestCase)
Test response if non-existing tile coordinates are requested.
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/falk/projects/django-spillway/django-spillway/tests/test_views.py", line 34, in test_not_existing_tile_coords
    response = self.client.get('/vectiles/3/1000/1000/')
  File "/home/falk/projects/django-spillway/env/local/lib/python2.7/site-packages/rest_framework/test.py", line 84, in get
    return self.generic('GET', path, **r)
  File "/home/falk/projects/django-spillway/env/local/lib/python2.7/site-packages/rest_framework/compat.py", line 489, in generic
    return self.request(**r)
  File "/home/falk/projects/django-spillway/env/local/lib/python2.7/site-packages/rest_framework/test.py", line 155, in request
    return super(APIClient, self).request(**kwargs)
  File "/home/falk/projects/django-spillway/env/local/lib/python2.7/site-packages/rest_framework/test.py", line 107, in request
    request = super(APIRequestFactory, self).request(**kwargs)
  File "/home/falk/projects/django-spillway/env/local/lib/python2.7/site-packages/django/test/client.py", line 444, in request
    six.reraise(*exc_info)
  File "/home/falk/projects/django-spillway/env/local/lib/python2.7/site-packages/django/core/handlers/base.py", line 112, in get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File "/home/falk/projects/django-spillway/env/local/lib/python2.7/site-packages/django/views/generic/base.py", line 69, in view
    return self.dispatch(request, *args, **kwargs)
  File "/home/falk/projects/django-spillway/env/local/lib/python2.7/site-packages/django/views/decorators/csrf.py", line 57, in wrapped_view
    return view_func(*args, **kwargs)
  File "/home/falk/projects/django-spillway/env/local/lib/python2.7/site-packages/rest_framework/views.py", line 400, in dispatch
    response = self.handle_exception(exc)
  File "/home/falk/projects/django-spillway/env/local/lib/python2.7/site-packages/rest_framework/views.py", line 397, in dispatch
    response = handler(request, *args, **kwargs)
  File "/home/falk/projects/django-spillway/env/local/lib/python2.7/site-packages/rest_framework/generics.py", line 425, in get
    return self.list(request, *args, **kwargs)
  File "/home/falk/projects/django-spillway/env/local/lib/python2.7/site-packages/rest_framework/mixins.py", line 76, in list
    self.object_list = self.filter_queryset(self.get_queryset())
  File "/home/falk/projects/django-spillway/django-spillway/spillway/views.py", line 37, in filter_queryset
    params = form.cleaned_data if form.is_valid() else {}
  File "/home/falk/projects/django-spillway/env/local/lib/python2.7/site-packages/django/forms/forms.py", line 129, in is_valid
    return self.is_bound and not bool(self.errors)
  File "/home/falk/projects/django-spillway/env/local/lib/python2.7/site-packages/django/forms/forms.py", line 121, in errors
    self.full_clean()
  File "/home/falk/projects/django-spillway/env/local/lib/python2.7/site-packages/django/forms/forms.py", line 274, in full_clean
    self._clean_form()
  File "/home/falk/projects/django-spillway/env/local/lib/python2.7/site-packages/django/forms/forms.py", line 300, in _clean_form
    self.cleaned_data = self.clean()
  File "/home/falk/projects/django-spillway/django-spillway/spillway/forms/forms.py", line 72, in clean
    extent = transform_tile(x, y, z) + transform_tile(x + 1, y + 1, z)
  File "/home/falk/projects/django-spillway/env/local/lib/python2.7/site-packages/greenwich/srs.py", line 16, in transform_tile
    lat_rad = math.atan(math.sinh(math.pi * (1 - 2 * ytile / n)))
OverflowError: math range error

----------------------------------------------------------------------
Ran 71 tests in 0.385s

Some imprecision in clipping

The error here is about .002 degree and there is some re-projection involved. I will explore further. (Using QGIS to explore).

screen shot 2016-02-08 at 4 58 09 pm

- it appears to be shifted (rather than cut short). The offset exists on the other side as well.

Improve API for raster creation?

While greenwich uses new raster creation under the hood all the time, I am wondering whether it would be worthwhile to expose it a little bit more conveniently to the user of the package, e.g. in order to create rasters from numpy arrays.

Do you think that it would be worth working on or are the few cases where you actually would create rasters from scratch sufficiently covered by the Python GDAL bindings?

Publish docs

I think this library could benefit a lot from some publicly visible auto-generated API docs. How about using Sphinx together with Read the Docs?

Clip fails for some Multipolygons

Currently I encountered problems with

  • Multipolygons that contain only a single geometry (patch in dev branch in my fork)
  • Multipolygons that contain a donut

(I might issue a pull request when I figure the later out).

Maybe I should mention what it could be good for (or what I am trying to use it for). Once I would be able to clip including holes, it would be very easy to derive zonal stats from the data.

Test output ok or problem with GDAL setup?

I am running test and the tests are passing. But I am getting some GDAL errors on the way. Question: Is this intended or does it indicates problems with my GDAL setup? On OSX - painful!

python setup.py test
running test
running egg_info
writing requirements to greenwich.egg-info/requires.txt
writing greenwich.egg-info/PKG-INFO
writing top-level names to greenwich.egg-info/top_level.txt
writing dependency_links to greenwich.egg-info/dependency_links.txt
reading manifest file 'greenwich.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
writing manifest file 'greenwich.egg-info/SOURCES.txt'
running build_ext
test_add (tests.test_geometry.EnvelopeTestCase) ... ok
test_contains (tests.test_geometry.EnvelopeTestCase) ... ok
test_eq (tests.test_geometry.EnvelopeTestCase) ... ok
test_expand (tests.test_geometry.EnvelopeTestCase) ... ok
test_init (tests.test_geometry.EnvelopeTestCase) ... ok
test_intersects (tests.test_geometry.EnvelopeTestCase) ... ok
test_invalid (tests.test_geometry.EnvelopeTestCase) ... ok
test_subtract (tests.test_geometry.EnvelopeTestCase) ... ok
test_geo_interface (tests.test_geometry.GeometryTestCase) ... ok
test_init (tests.test_geometry.GeometryTestCase) ... ok
test_init_spatialref (tests.test_geometry.GeometryTestCase) ... ok
test_close (tests.test_io.MemFileIOTestCase) ... ok
test_read (tests.test_io.MemFileIOTestCase) ... ok
test_readinto (tests.test_io.MemFileIOTestCase) ... ok
test_seek (tests.test_io.MemFileIOTestCase) ... ok
test_truncate (tests.test_io.MemFileIOTestCase) ... ok
test_write (tests.test_io.MemFileIOTestCase) ... ok
test_close (tests.test_io.VSIFileTestCase) ... ok
test_read_missing (tests.test_io.VSIFileTestCase) ... ok
test_vsiprefix (tests.test_io.VSIFileTestCase) ... ok
test_write_error (tests.test_io.VSIFileTestCase) ... ok
test_transform_to_projected (tests.test_raster.AffineTransformTestCase) ... ok
test_copy (tests.test_raster.ImageDriverTestCase) ... ok
test_copy_path (tests.test_raster.ImageDriverTestCase) ... ok
test_driver_for_path (tests.test_raster.ImageDriverTestCase) ... ok
test_filter_writable (tests.test_raster.ImageDriverTestCase) ... ok
test_init (tests.test_raster.ImageDriverTestCase) ... ok
test_options (tests.test_raster.ImageDriverTestCase) ... ok
test_raster (tests.test_raster.ImageDriverTestCase) ... ok
test_raster_compression (tests.test_raster.ImageDriverTestCase) ... ok
test_raster_fromfile (tests.test_raster.ImageDriverTestCase) ... ok
test_raster_netcdf (tests.test_raster.ImageDriverTestCase) ... ok
test_raster_size_args (tests.test_raster.ImageDriverTestCase) ... ok
test_affine (tests.test_raster.RasterTestCase) ... ok
test_array (tests.test_raster.RasterTestCase) ... ok
test_clip (tests.test_raster.RasterTestCase)
Test clipping a raster with a geometry. ... ok
test_close (tests.test_raster.RasterTestCase) ... ok
test_count_unique (tests.test_raster.RasterTestCase) ... ok
test_crop (tests.test_raster.RasterTestCase)
Test image cropping with OGR Geometries. ... ok
test_envelope (tests.test_raster.RasterTestCase) ... ok
test_frombytes (tests.test_raster.RasterTestCase) ... ok
test_geom_to_array (tests.test_raster.RasterTestCase) ... ok
test_init (tests.test_raster.RasterTestCase) ... ERROR 4: `zzz' does not exist in the file system,
and is not recognised as a supported dataset name.

ERROR 5: /var/folders/b3/6s1dghp92hx6z43nz443zj8w0000gp/T/tmpXmc8qN.tif: GDALDataset::GetRasterBand(4) - Illegal band #

ok
test_new (tests.test_raster.RasterTestCase) ... ok
test_nodata (tests.test_raster.RasterTestCase) ... ok
test_open (tests.test_raster.RasterTestCase) ... ok
test_open_bytesio (tests.test_raster.RasterTestCase) ... ERROR 4: `/vsimem/0752d3d4-bbeb-4216-9f01-3559b167f1a3' not recognised as a supported file format.

ok
test_resample (tests.test_raster.RasterTestCase) ... ok
test_save (tests.test_raster.RasterTestCase) ... ok
test_save_memio (tests.test_raster.RasterTestCase) ... ok
test_slice (tests.test_raster.RasterTestCase) ... ok
test_warp (tests.test_raster.RasterTestCase) ... ok
test_epsg (tests.test_srs.SpatialReferenceTestCase) ... ok
test_epsg_strings (tests.test_srs.SpatialReferenceTestCase) ... ok
test_equality (tests.test_srs.SpatialReferenceTestCase) ... ok
test_named_crs (tests.test_srs.SpatialReferenceTestCase) ... ok
test_proj4 (tests.test_srs.SpatialReferenceTestCase) ... ok
test_wkt (tests.test_srs.SpatialReferenceTestCase) ... ok
test_invalid_tile (tests.test_srs.TransformTileTestCase) ... ok
test_transform (tests.test_srs.TransformTileTestCase) ... ok

----------------------------------------------------------------------
Ran 60 tests in 0.341s

OK

Migrate to Python 3.5

I am getting an import error in io.py

from urlparse import urlparse

Module has been renamed to urllib.parse and the old version has been removed.

Clip fails for geoms smaller than raster cells

Related test can be found in the dev branch of my fork, see 0f73c3c.

Deeper debugging revealed that clipping tries to create a raster with size = (0, 0). It throws an ImageDriver error accordingly. I did not add assertion but it should probably assert size = (1,1).

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.