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

Add geojson format #4

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open

Add geojson format #4

wants to merge 3 commits into from

Conversation

mpfeil
Copy link
Owner

@mpfeil mpfeil commented Jan 24, 2020

No description provided.

@mpfeil mpfeil requested a review from ubergesundheit January 24, 2020 14:55
@mpfeil
Copy link
Owner Author

mpfeil commented Jan 24, 2020

Test are missing

index.js Outdated Show resolved Hide resolved
index.js Show resolved Hide resolved
index.js Outdated
Comment on lines 139 to 140
parseFloat(steckbrief.longitude),
parseFloat(steckbrief.latitude)
Copy link
Collaborator

Choose a reason for hiding this comment

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

I would suggest parsing and validating (for NaN for example) these before pushing into the geojson result.

Also I would vouch for not using parseFloat. The MDN page for parseFloat says one should use Number() instead

Copy link
Owner Author

Choose a reason for hiding this comment

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

What would you suggest if longitude or latitude is NaN? Throwing an error and rejecting? Or just returning some defaults?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Just looked this up in the GeoJSON spec which says:

A Feature object has a member with the name "geometry". The value
of the geometry member SHALL be either a Geometry object as
defined above or, in the case that the Feature is unlocated, a JSON null value.

so setting the geometry to null would be according to the spec. The unparseable coordinate would appear in the properties anyway, right?

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.

2 participants