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

Switch WKT to use type over class name. #81

Merged
merged 3 commits into from
Aug 5, 2022

Conversation

eseglem
Copy link
Collaborator

@eseglem eseglem commented Aug 1, 2022

What I am changing

  • Make the _wkt_type function work when the class is inherited from.

How I did it

  • Switched the _wkt_type function to use the type. Since a "type" MUST exist in the spec, and it cannot be modified. It will always match the WKT type unlike the class name.

How you can test it

  • Tests still run properly. And now this works:
from geojson_pydantic import Point
class PointType(Point):
    ...

print(PointType(coordinates=[123, 123]).wkt)
# POINT (123.0 123.0)

Related Issues

Copy link
Contributor

@geospatial-jeff geospatial-jeff left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@vincentsarago vincentsarago merged commit b53d412 into developmentseed:master Aug 5, 2022
@eseglem eseglem deleted the feature/wtk-from-type branch February 10, 2023 14:17
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.

Problem with "wkt" method.
3 participants