Comments (4)
Thanks for raising the issue. Could you please provide a small reproducible code snippet of the geometry that gives this error?
from topojson.
I can reproduce the issue:
import s2sphere as s2
from shapely import geometry
import topojson
region_rect = s2.LatLngRect(
s2.LatLng.from_degrees(-51.264871, -30.241701),
s2.LatLng.from_degrees(-51.04618, -30.000003))
coverer = s2.RegionCoverer()
coverer.min_level=10
coverer.max_level=11
coverer.max_cells=500
covering = coverer.get_covering(region_rect)
geoms = []
for cellid in covering:
new_cell = s2.Cell(cellid)
vertices = []
for i in range(0, 4):
vertex = new_cell.get_vertex(i)
latlng = s2.LatLng.from_point(vertex)
vertices.append((latlng.lat().degrees,latlng.lng().degrees))
geo = geometry.Polygon(vertices)
geoms.append(geo)
print("Total Geometries: {}".format(len(geoms)))
geometry.GeometryCollection(geoms)
Total Geometries: 19
topojson.Topology(geoms, prequantize=False, topology=True)
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-2-a207dd4fcbb5> in <module>
----> 1 topojson.Topology(geoms, prequantize=False, topology=True)
~/topojson/topojson/core/topology.py in __init__(self, data, topology, prequantize, topoquantize, presimplify, toposimplify, simplify_with, simplify_algorithm, winding_order)
94 options = TopoOptions(locals())
95 # execute previous steps
---> 96 super().__init__(data, options)
97
98 # execute main function of Topology
~/topojson/topojson/core/hashmap.py in __init__(self, data, options)
20 def __init__(self, data, options={}):
21 # execute previous step
---> 22 super().__init__(data, options)
23
24 # initation topology items
~/topojson/topojson/core/dedup.py in __init__(self, data, options)
26
27 # execute main function of Dedup
---> 28 self.output = self.deduper(self.output)
29
30 def __repr__(self):
~/topojson/topojson/core/dedup.py in deduper(self, data)
77 # apply linemerge on geoms containing contigious arcs and maintain
78 # bookkeeping
---> 79 self.merge_contigious_arcs(data, sliced_array_bk_ndp)
80
81 # pop the merged contigious arcs and maintain bookkeeping.
~/topojson/topojson/core/dedup.py in merge_contigious_arcs(self, data, sliced_array_bk_ndp)
219
220 # replace linestring of idx_keep with merged linestring
--> 221 data["linestrings"][idx_keep] = ndp_arcs[idx_merg_arc]
222 self.merged_arcs_idx.append(idx_pop)
223
TypeError: list indices must be integers or slices, not NoneType
from topojson.
Previously the Dedup class deduplicate identical arcs and tries to apply a line merge on non-duplicate LineStrings. In this line merging section it assumed that this only could happen on 2 arcs. This assumption proved wrong and is fixed by #51.
from topojson.
Sorry, the late reply.
Got it, thanks a lot @mattijn !!
from topojson.
Related Issues (20)
- Topology modifies source data
- Topojson bbox should not be transformed when loading Topojson-dict HOT 1
- toposimplify wrongly applied on Topojson data from file
- Reduce decimal places when converting to GeoJSON HOT 2
- Shapely deprecation warnings in topojson 1.3 HOT 5
- Keep geojson properties HOT 6
- Merge multiple layers in a single topojson HOT 5
- Conversion to Typology object causes overlaps HOT 5
- tp.Topology.to_json(pretty=True) doesn't handle None correctly. (Doens't convert None to null) HOT 1
- Converting GeoJSON FeatureCollection to TopoJSON HOT 1
- BUG: `Topology.to_gdf` should keep the original index HOT 2
- holes in multipolygons are lost by simplification HOT 4
- Deprecation warning for shapely 2.0 HOT 3
- Wrong topologies/arcs being created? HOT 7
- Creating a topology for data without junctions and shared_coords=False, prequantize=False gives error
- Bug: polygons that entirely fill islands in another polygon are often not dedupped
- shared_coords=True vs shared_coords=False HOT 5
- Linestrings that follow the same path but where one contains extra redundant points are not deduplicated
- enh: include features that are possible with shapely 2.0
- tests failing, natural earth dataset changed HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from topojson.