Comments (2)
Alternatively, if you want to give some guidance on how you'd like it to to pipe forward attributes, or even just the id property on the geometry objects as that's all I really need, I can try writing a PR.
from topojson.
Hi.
I would put attributes within the properties
as per the definition of a Feature, see https://geojson.org.
Example:
import topojson as tp
obj = tp.utils.example_data_africa()
# object prior entering topojson
obj0 = obj[0].copy()
del obj0['geometries'] # all info except geometries
print(obj0)
{'id': '1', 'type': 'GeometryCollection', 'properties': {'continent': 'Africa', 'gdp_md_est': 150600.0, 'iso_a3': 'TZA', 'name': 'Tanzania', 'pop_est': 53950935}, 'bbox': (29.339997592900346, -11.720938002166735, 40.31659000000002, -0.9500000000000001)}
# object after topojson
topo = tp.Topology(obj).to_dict()
after_obj0 = topo['objects']['data']['geometries'][0]
after_obj0
{'id': '1', 'type': 'Polygon', 'properties': {'continent': 'Africa', 'gdp_md_est': 150600.0, 'iso_a3': 'TZA', 'name': 'Tanzania', 'pop_est': 53950935}, 'bbox': (29.339997592900346, -11.720938002166735, 40.31659000000002, -0.9500000000000001), 'arcs': [[-6, 0, -84, -82, -77, -3, -100, -140, -137]]}
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.