#3020 closed enhancement (fixed)
Extend python TransformPoints typemap to accept any sequence
Reported by: | hogend | Owned by: | Even Rouault |
---|---|---|---|
Priority: | normal | Milestone: | 1.7.0 |
Component: | PythonBindings | Version: | 1.6.1 |
Severity: | normal | Keywords: | |
Cc: |
Description
The python TransformPoints typemap requires coordinates to be 2- or 3-tuples. The attached diff to typemaps_python.i allows any sequence, i.e. lists or, more importantly, numpy arrays
Attachments (1)
Change History (4)
by , 15 years ago
Attachment: | gdal-1.6.1-typemap.diff added |
---|
comment:1 by , 15 years ago
Owner: | changed from | to
---|---|
Status: | new → assigned |
follow-up: 3 comment:2 by , 15 years ago
Milestone: | → 1.7.0 |
---|---|
Resolution: | → fixed |
Status: | assigned → closed |
comment:3 by , 15 years ago
Replying to rouault:
Hogend,
I applied in trunk (r17189) a slightly modified version of your patch that mainly adds the VSIMalloc and NULL pointer checks to replace CPLMalloc. I also removed the last bit of your patch that did : PyObject *xyz = PyList_New( $1 ); .... PyTuple_SetItem( xyz, i, tuple ); which looks very suspicious to me (using PyTuple_SetItem on a PyList ?). Test added in r17190.
Thanks.
You are right about the the PyTuple_SetItem; it must be PyList_SetItem (Initially, I returned tuples, but tried to change it back to a tuple of lists of tuples ;)
One note, you raise a runtime exception, isn't it better to use
PyErr_SetString( PyExc_MemoryError, "in TransformPoints" );
?
Regards,
Rene
Hogend,
I applied in trunk (r17189) a slightly modified version of your patch that mainly adds the VSIMalloc and NULL pointer checks to replace CPLMalloc. I also removed the last bit of your patch that did : PyObject *xyz = PyList_New( $1 ); .... PyTuple_SetItem( xyz, i, tuple ); which looks very suspicious to me (using PyTuple_SetItem on a PyList ?). Test added in r17190.
Thanks.