Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

include (multi) point #62

Merged
merged 9 commits into from
Nov 3, 2019
Merged

include (multi) point #62

merged 9 commits into from
Nov 3, 2019

Conversation

mattijn
Copy link
Owner

@mattijn mattijn commented Oct 13, 2019

This PR is the start of including Point and MultiPoint as input types.
It takes more time than a Sunday evening (maybe another Sunday evening).

There is now a separation between bookkeeping of arcs (originating from LineString, MultiLineString, Polygon, MultiPolygon and GeometryCollection) and bookkeeping of coordinates (originating from Point and MultiPoint).

The difficulty is to include the bookkeeping of coordinates at the places when it is needed in the same structure as the bookkeeping of arcs.

Still some thinking to do in the hash mapping and single point transform computation

Not finished yet.

@mattijn
Copy link
Owner Author

mattijn commented Nov 3, 2019

This is fixed.

Within the Topojson format the coordinates of type Point and MultiPoint are not stored in the top-key arcs object, but remain within the objects. This is quite cumbersome since quantization does apply to the coordinates as well.

Resolved internally by storing the coordinates on top-key level as shapely objects till the topology phase and only resolved into lists within the to_dict()/to_alt()/etc functions.

This is different compare the arcs which are resolved within the hashmap class.

Add multi different tests in the various classes since there were eventually changes in more or less all classes

Working example:

import topojson as tp

data = [
    {
        "type": "MultiPoint",
        "coordinates": [[0.5, 0.8], [1.0, 1.1]]     
    },    
    {
        "type": "Point",
        "coordinates": [1.1, 0.5]    
    },      
    {
        "type": "Polygon",
        "coordinates": [[[0, 0], [0.5, 0], [0.5, 0.5], [0, 0.5], [0, 0]]]
    }

]

topo = tp.Topology(data, topoquantize=True)
topo.to_alt(color='geometry.type:N')

output_2_0

@mattijn mattijn merged commit 65dff75 into master Nov 3, 2019
@mattijn mattijn changed the title WIP: include (multi) point include (multi) point Nov 3, 2019
@mattijn mattijn deleted the WIP--include-(multi)-points branch December 1, 2019 16:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant