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 functions for presimplify and toposimplify #35

Merged
merged 1 commit into from Aug 5, 2019

Conversation

mattijn
Copy link
Owner

@mattijn mattijn commented Aug 5, 2019

This can now works as follow:

import geopandas
import topojson

Select some data

data = geopandas.read_file(geopandas.datasets.get_path("naturalearth_lowres"))
data = data[
    (data.continent == "South America")
]

Use the presimplify option to set a value to simplify. Presimplify applies simplification on the LineStrings before any computation on the topology has happened.

topojson.Topology(
    data, options={'topology':True, 'presimplify':2}
).to_alt(color='properties.name:N', projection='mercator')

output_2_0

Use toposimplify for applying simplification on the LineStrings after performing of topology computation.

topojson.Topology(
    data, options={'topology':True, 'toposimplify':2}
).to_alt(color='properties.name:N', projection='mercator')

output_3_0

Notes:

  • Applying toposimplify in combination with topology: False behave the same as presimplify.
  • Currently toposimplify does not work in combination with prequantize.
  • A lot of counter cases where too small or too high values are used for the simplifying is not covered, since I have not yet a clear feeling what these values for simplification mean.

@mattijn mattijn merged commit 1be69bf into master Aug 5, 2019
@mattijn mattijn deleted the feat-toposimplify-and-presimplify branch August 5, 2019 06:55
@mattijn mattijn mentioned this pull request Aug 5, 2019
8 tasks
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