Skip to content
This repository was archived by the owner on Oct 9, 2025. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ python:
- 3.5
- 3.6
- 3.7
- 3.8
install:
- pip install nose
- pip install flake8
Expand Down
16 changes: 14 additions & 2 deletions esrijson/geometry.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,11 +99,23 @@ def from_shape(obj, wkid=None):
if type_ == 'GeometryCollection':
# No concept of GeometryCollection in esri_json therefore we take
# the first one only
# We also may have a collections of collections
if len(obj['geometries']) == 0:
return esri_geom
first = obj['geometries'][0]
type_ = first.pop('type')
coords = first.pop('coordinates')
if type(first) == list:
types_ = [d['type'] for d in first]
coords = [d['coordinates'] for d in first]
if len(set(types_)) == 1 and \
types_[0] in ('Point', 'LineString', 'Polygon'):
type_ = 'Multi' + types_[0]
else:
raise TypeError('Cannot convert collection of different ' +
'types into an Esri Multi(Point|LineString' +
'|Polygon)')
else:
type_ = first.pop('type')
coords = first.pop('coordinates')
else:
coords = obj.pop('coordinates')
if type_:
Expand Down
3 changes: 2 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
long_description = fh.read()

setup(name='esrijson',
version='0.4.3',
version='0.4.4',
description='Bindings and utilities for EsriJSON',
long_description=long_description,
long_description_content_type="text/markdown",
Expand All @@ -21,6 +21,7 @@
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8',
'Topic :: Scientific/Engineering :: GIS',
'Topic :: Software Development :: Libraries :: Python Modules'
],
Expand Down