[Django] #24207: contrib gis change ogrinspect multi_geom default to True

36 views
Skip to first unread message

Django

unread,
Jan 23, 2015, 5:20:05 AM1/23/15
to django-...@googlegroups.com
#24207: contrib gis change ogrinspect multi_geom default to True
--------------------------------------+-----------------------------
Reporter: mdiener21 | Owner: nobody
Type: Cleanup/optimization | Status: new
Component: GIS | Version: 1.8alpha1
Severity: Normal | Keywords: gis, multi_geom
Triage Stage: Unreviewed | Has patch: 0
Easy pickings: 1 | UI/UX: 0
--------------------------------------+-----------------------------
I would recommend changing the /contrib/gis/util/ogrinspect.py default
to use "Multi" geometry because this will eliminate ERROR when trying to
import a data set that could contain both linestring and multilinestring
for example.

The reason is that gdal cannot always guess the correct geometry type for
example in a Shapefile.

# TODO: Autodetection of multigeometry types (see #7218).

--
Ticket URL: <https://code.djangoproject.com/ticket/24207>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Jan 23, 2015, 5:35:56 AM1/23/15
to django-...@googlegroups.com
#24207: contrib gis change ogrinspect multi_geom default to True
-------------------------------------+-------------------------------------
Reporter: mdiener21 | Owner: nobody
Type: | Status: new
Cleanup/optimization |
Component: GIS | Version: 1.8alpha1
Severity: Normal | Resolution:

Keywords: gis, multi_geom | Triage Stage:
| Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by mdiener21):

* needs_better_patch: => 0
* needs_tests: => 0
* needs_docs: => 0


Old description:

> I would recommend changing the /contrib/gis/util/ogrinspect.py default
> to use "Multi" geometry because this will eliminate ERROR when trying to
> import a data set that could contain both linestring and multilinestring
> for example.
>
> The reason is that gdal cannot always guess the correct geometry type for
> example in a Shapefile.
>
> # TODO: Autodetection of multigeometry types (see #7218).

New description:

I would recommend changing the /contrib/gis/util/ogrinspect.py default
to use "Multi" geometry because this will eliminate ERROR when trying to
import a data set that could contain both linestring and multilinestring
for example.

The reason is that gdal cannot always guess the correct geometry type for
example in a Shapefile.

link to my GIT Branch
https://github.com/mdiener21/django/blob/master/django/contrib/gis/utils/ogrinspect.py


# TODO: Autodetection of multigeometry types (see #7218).

--

Comment:

forgot the link to my GIT branch
https://github.com/mdiener21/django/blob/master/django/contrib/gis/utils/ogrinspect.py

Pull Request was already sent off :)

--
Ticket URL: <https://code.djangoproject.com/ticket/24207#comment:1>

Django

unread,
Jan 23, 2015, 6:18:39 AM1/23/15
to django-...@googlegroups.com
#24207: contrib gis change ogrinspect multi_geom default to True
-------------------------------------+-------------------------------------
Reporter: mdiener21 | Owner: mdiener21
Type: | Status: assigned
Cleanup/optimization |
Component: GIS | Version: 1.8alpha1
Severity: Normal | Resolution:

Keywords: gis, multi_geom | Triage Stage:
| Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by mdiener21):

* owner: nobody => mdiener21
* cc: mdiener21@… (added)
* status: new => assigned


--
Ticket URL: <https://code.djangoproject.com/ticket/24207#comment:2>

Django

unread,
Mar 3, 2015, 3:15:29 PM3/3/15
to django-...@googlegroups.com
#24207: contrib gis change ogrinspect multi_geom default to True
-------------------------------------+-------------------------------------
Reporter: mdiener21 | Owner: mdiener21
Type: | Status: assigned
Cleanup/optimization |
Component: GIS | Version: 1.8alpha1
Severity: Normal | Resolution:

Keywords: gis, multi_geom | Triage Stage:
| Unreviewed
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by timgraham):

* has_patch: 0 => 1
* easy: 1 => 0


Comment:

[https://github.com/django/django/pull/3979 PR]

--
Ticket URL: <https://code.djangoproject.com/ticket/24207#comment:3>

Django

unread,
Mar 3, 2015, 3:15:43 PM3/3/15
to django-...@googlegroups.com
#24207: Change ogrinspect multi_geom default to True

-------------------------------------+-------------------------------------
Reporter: mdiener21 | Owner: mdiener21
Type: | Status: assigned
Cleanup/optimization |
Component: GIS | Version: 1.8alpha1
Severity: Normal | Resolution:

Keywords: gis, multi_geom | Triage Stage:
| Unreviewed
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

--
Ticket URL: <https://code.djangoproject.com/ticket/24207#comment:4>

Django

unread,
Mar 4, 2015, 12:26:18 PM3/4/15
to django-...@googlegroups.com
#24207: Change ogrinspect multi_geom default to True
-------------------------------------+-------------------------------------
Reporter: mdiener21 | Owner: mdiener21
Type: | Status: closed
Cleanup/optimization |
Component: GIS | Version: 1.8alpha1
Severity: Normal | Resolution: wontfix

Keywords: gis, multi_geom | Triage Stage:
| Unreviewed
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by claudep):

* status: assigned => closed
* resolution: => wontfix


Comment:

I'm not convinced to force multi geometries by default. If you obtain
errors when importing data from a shapefile because of a missing multi
field, you can always improve your model and force the multi geometries in
a later time. And if you don't want to risk the potential errors, there is
the `multi_geom` parameter you can set yourself.

Feel free to add more arguments if you think I missed the point.

--
Ticket URL: <https://code.djangoproject.com/ticket/24207#comment:5>

Django

unread,
May 5, 2015, 7:24:41 AM5/5/15
to django-...@googlegroups.com
#24207: Change ogrinspect multi_geom default to True
-------------------------------------+-------------------------------------
Reporter: mdiener21 | Owner: mdiener21
Type: | Status: closed
Cleanup/optimization |
Component: GIS | Version: 1.8alpha1
Severity: Normal | Resolution: wontfix

Keywords: gis, multi_geom | Triage Stage:
| Unreviewed
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by mdiener21):

Hi the problem is this code if multi_geom and gtype.num in (1, 2, 3):
LINE 213 gtype.num in (1,2,3) does NOT always return TRUE for
multi_geom because GDAL does not always guess correct. Therefore if I set
multi_geom to True it still fails because GDAL guesses wrong. Another
solution is to simply remove the GDAL check ? any thoughts

--
Ticket URL: <https://code.djangoproject.com/ticket/24207#comment:6>

Django

unread,
May 5, 2015, 7:25:50 AM5/5/15
to django-...@googlegroups.com
#24207: Change ogrinspect multi_geom default to True
-------------------------------------+-------------------------------------
Reporter: mdiener21 | Owner: mdiener21
Type: | Status: closed
Cleanup/optimization |
Component: GIS | Version: 1.8alpha1
Severity: Normal | Resolution: wontfix

Keywords: gis, multi_geom | Triage Stage:
| Unreviewed
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by mdiener21):

Replying to [comment:5 claudep]:


> I'm not convinced to force multi geometries by default. If you obtain
errors when importing data from a shapefile because of a missing multi
field, you can always improve your model and force the multi geometries in
a later time. And if you don't want to risk the potential errors, there is
the `multi_geom` parameter you can set yourself.
>
> Feel free to add more arguments if you think I missed the point.


Please check out my comment :) cheers

--
Ticket URL: <https://code.djangoproject.com/ticket/24207#comment:7>

Django

unread,
May 5, 2015, 2:09:18 PM5/5/15
to django-...@googlegroups.com
#24207: Change ogrinspect multi_geom default to True
-------------------------------------+-------------------------------------
Reporter: mdiener21 | Owner: mdiener21
Type: | Status: closed
Cleanup/optimization |
Component: GIS | Version: 1.8alpha1
Severity: Normal | Resolution: wontfix

Keywords: gis, multi_geom | Triage Stage:
| Unreviewed
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by claudep):

Do you have an example of such a "deficient" layer? It would be nice to
make a test case for this issue.

--
Ticket URL: <https://code.djangoproject.com/ticket/24207#comment:8>

Django

unread,
May 6, 2015, 3:21:35 AM5/6/15
to django-...@googlegroups.com
#24207: Change ogrinspect multi_geom default to True
-------------------------------------+-------------------------------------
Reporter: mdiener21 | Owner: mdiener21
Type: | Status: closed
Cleanup/optimization |
Component: GIS | Version: 1.8alpha1
Severity: Normal | Resolution: wontfix

Keywords: gis, multi_geom | Triage Stage:
| Unreviewed
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by mdiener21):

* Attachment "gas_lines.zip" added.

Shapefile Example with both Linestrings and Multilinestrings

Django

unread,
May 6, 2015, 4:25:09 AM5/6/15
to django-...@googlegroups.com
#24207: Change ogrinspect multi_geom default to True
-------------------------------------+-------------------------------------
Reporter: mdiener21 | Owner: mdiener21
Type: | Status: closed
Cleanup/optimization |
Component: GIS | Version: 1.8alpha1
Severity: Normal | Resolution: wontfix

Keywords: gis, multi_geom | Triage Stage:
| Unreviewed
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by mdiener21):

Yes I do, the Shapefile origin is AutoCAD and this is where things get
messy when converting to Shapefile then trying to import into PostGIS. I
have attached the problem Shapefile of multilinestrings which is a false
positive "linestring" according to GDAL and QGIS (which uses GDAL). The
Shapefile is of course valid with no geometry errors or invalid geometries
all is good. The problem is the Shapefile can store linestrings and
multi-geom and still be valid. When trying to import such a Shapefile
PostGIS will NOT allow you to have both you must choose and in this case
you must always choose the multi-geom "MULTILINESTRING" geom type
otherwise boom error on import.

--
Ticket URL: <https://code.djangoproject.com/ticket/24207#comment:9>

Django

unread,
May 6, 2015, 5:39:24 AM5/6/15
to django-...@googlegroups.com
#24207: ogrinspect multi_geom doesn't account for 25D types

-------------------------------------+-------------------------------------
Reporter: mdiener21 | Owner: mdiener21
Type: | Status: new
Cleanup/optimization |
Component: GIS | Version: 1.8alpha1
Severity: Normal | Resolution:
Keywords: gis, multi_geom | Triage Stage: Accepted

Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by claudep):

* status: closed => new
* needs_better_patch: 0 => 1
* resolution: wontfix =>
* stage: Unreviewed => Accepted


Comment:

Thanks, that's very useful. This demonstrates that the inspect code hasn't
been updated after commit [c169f8cb174c9a885] to take `25D` OGR types into
account.

--
Ticket URL: <https://code.djangoproject.com/ticket/24207#comment:10>

Django

unread,
May 6, 2015, 6:01:44 AM5/6/15
to django-...@googlegroups.com
#24207: ogrinspect multi_geom doesn't account for 25D types
-------------------------------------+-------------------------------------
Reporter: mdiener21 | Owner: mdiener21
Type: | Status: new
Cleanup/optimization |
Component: GIS | Version: 1.8alpha1

Severity: Normal | Resolution:
Keywords: gis, multi_geom | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by claudep):

* needs_better_patch: 1 => 0


Comment:

New PR: https://github.com/django/django/pull/4617

--
Ticket URL: <https://code.djangoproject.com/ticket/24207#comment:11>

Django

unread,
May 6, 2015, 8:04:02 AM5/6/15
to django-...@googlegroups.com
#24207: ogrinspect multi_geom doesn't account for 25D types
-------------------------------------+-------------------------------------
Reporter: mdiener21 | Owner: mdiener21
Type: | Status: new
Cleanup/optimization |
Component: GIS | Version: master
Severity: Normal | Resolution:
Keywords: gis, multi_geom | Triage Stage: Ready for
| checkin

Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by timgraham):

* version: 1.8alpha1 => master
* stage: Accepted => Ready for checkin


--
Ticket URL: <https://code.djangoproject.com/ticket/24207#comment:12>

Django

unread,
May 6, 2015, 2:33:02 PM5/6/15
to django-...@googlegroups.com
#24207: ogrinspect multi_geom doesn't account for 25D types
-------------------------------------+-------------------------------------
Reporter: mdiener21 | Owner: mdiener21
Type: | Status: closed

Cleanup/optimization |
Component: GIS | Version: master
Severity: Normal | Resolution: fixed

Keywords: gis, multi_geom | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Claude Paroz <claude@…>):

* status: new => closed
* resolution: => fixed


Comment:

In [changeset:"d1df1fd2bb274574fd895f6984892b3aba372f48" d1df1fd2]:
{{{
#!CommitTicketReference repository=""
revision="d1df1fd2bb274574fd895f6984892b3aba372f48"
Fixed #24207 -- Added 25D-type geometry field support to ogrinspect

Thanks Michael Diener for the report and sample data, and Tim Graham
for the review.
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/24207#comment:13>

Reply all
Reply to author
Forward
0 new messages