Closed michaelcurry closed 5 years ago
Linked to Issue #13
Thanks for the PR! :+1: First remarks:
$geojson_array['TYPE']
; I've seen lowercase examples myself, therefore I assume that keys are not case-sensitive; as such, we would need to strtolower() or strtoupper() everything before each comparison.This looks very good so far! 👍 I will provide my comments inline (mostly nitpicks).
Something that would be nice also, it to provide an explanation to each "Invalid GeoJSON" exception, as there is no clue where the error lies at the moment.
Something that would be nice also, it to provide an explanation to each "Invalid GeoJSON" exception, as there is no clue where the error lies at the moment.
Resolved in Commit: https://github.com/brick/geo/pull/14/commits/a3eda381fe0c7cb6e8fb619f3390f74641d02a9a
@BenMorel I believe I hit everything in your review. Please let me know if there is anything else 👍
Also, Thanks for the Quick Review 🎊
Looks like I broke the tests earlier. I have resolved the issue in commit https://github.com/brick/geo/pull/14/commits/150043e608991fb83ecaa7daee74e21c2456016f Apologies
@BenMorel All Review Items have been resolved. Please take another look at the Pull Request and let me know if there is anything else :+1:
@BenMorel I believe I hit all change requests. Please let me know if I missed anything and I will get a Commit in for change ASAP.
Looks all right to me! 👍
Final thoughts:
__construct(bool $lenient = false)
GeoJSONWriter::write()
would be an optional bool $prettyPrint = false
parameter, that would set the JSON_PRETTY_PRINT
flag in json_encode()
, to get a human readable output?Note that these are not mandatory and can be added later, but I'd like to have your thoughts on this.
just to confirm, you finally decided to be strict on case sensitivity of values, e.g. not accept "POLYGON" instead of "Polygon"? Something I had in mind could be to allow the parser to be lenient on case sensitivity, by a constructor configuration:
__construct(bool $lenient = false)
Looking other a few of the implementations of GeoJSON, they seem to be pretty standard in Case Sensitivity. That being said, I do think there should be a way for the user to "opt-in" to case insensitive mode.
something useful to add to
GeoJSONWriter::write()
would be an optionalbool $prettyPrint = false
parameter, that would set theJSON_PRETTY_PRINT
flag injson_encode()
, to get a human readable output?
I agree! I could see where that would be useful. Did not cross my mind too be honest.
If these are not mandatory for the initial tag/release, I would like to complete these in a separate Pull Request. If you are ok with that, I can make new Issues and you can assign them to me?
Excellent work here, thank you! 👍
Let's do this, you can open pull requests to add the features above. No need to open issues, you can open pull requests only, they're redundant!
IO GeoJSON Support
Adding the ability to Read & Write GeoJson as an IO option.
FeatureCollection
Feature
Point
MultiPoint
LineString
MultiLineString
Polygon
MultiPolygon
NOTE: Z-Axis is supported