-
Notifications
You must be signed in to change notification settings - Fork 5
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
Handle null geometry #1
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -60,28 +60,50 @@ function translate (input) { | |
|
||
return { | ||
type: 'FeatureCollection', | ||
features: [ formatFeature(input) ], | ||
features: [formatFeature(input)], | ||
metadata: { | ||
geometryType: geometry | ||
} | ||
} | ||
} else { | ||
const features = []; | ||
input.features.map((feature) => { | ||
features.push(formatFeature(feature)) | ||
}) | ||
|
||
|
||
// Or it's a feature collection | ||
return input; | ||
return { | ||
type: 'FeatureCollection', | ||
features: features | ||
} | ||
} | ||
} | ||
|
||
function formatFeature (geometry) { | ||
|
||
const feature = { | ||
type: 'Feature', | ||
properties: { | ||
"type": geometry.type | ||
}, | ||
geometry: geometry | ||
function formatFeature (input) { | ||
let feature = {}; | ||
if(input.type == "Feature") { | ||
feature = input; | ||
if(feature.geometry === undefined || feature.geometry === null) { | ||
feature.geometry = { | ||
type: "Point", | ||
coordinates: [ 0, 0] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What are your thoughts on setting this as There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. still kind of a hack, ideally we'd be able to handle There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I took some sample data and removed geometry so as to simulate There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ok...oh Pro, why you so fickle? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. do you think we should make the data conform inside Winnow or throw a warning somewhere? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We could both, that way providers wouldn't have to do this kind of transformation, but then there would be a paper trail should questions arise. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. works for me |
||
} | ||
} | ||
} else { | ||
feature = { | ||
type: 'Feature', | ||
properties: { | ||
type: 'no location' | ||
} | ||
} | ||
if(input !== undefined && input !== null) { | ||
feature.properties.type = input.type; | ||
feature.geometry = geometry; | ||
} | ||
} | ||
|
||
|
||
return feature | ||
} | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
===
instead of==