-
-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Restore the WKT parser, example & tests #2172
Conversation
Thanks for taking this on @GingerIK! We briefly discussed starting this from scratch and writing a tokenizer based parser. But I think your approach is probably the shortest path to success. Assuming you intend to continue adapting this so it extends from I'll let others weigh in, but I'd say go for it (as long as it conforms to the same interface, we can rewrite later if someone is motivated). |
You're welcome, I am happy I can finally do something in return for this great library. I am almost done extending from P.S. I am willing to write a tokenizer based parser as well later on, if someone can provide me with an example to start from. |
I think by default all WKT should be read as as a single geometry. For We could have an option to split var format = new ol.format.WKT({splitCollection: true});
var features = format.readFeatures(wktWithGeometryCollection);
// one feature for each geometry in the collection I don't think this option should also split/explode |
Your solution makes sense, so I added the |
Any news on this? |
@@ -31,7 +26,7 @@ var vector = new ol.layer.Vector({ | |||
|
|||
var map = new ol.Map({ | |||
layers: [raster, vector], | |||
renderer: ol.RendererHint.CANVAS, | |||
renderer: exampleNS.getRendererFromQueryString(), |
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.
Only the canvas renderer supports vector rendering. Can you remove this renderer
option altogether ("canvas"
is the default).
Thanks for the continued work on this @GingerIK. I made a few additional comments that should be straightforward to address. At some point I imagine we could rewrite this with a simple lexer (these regexes are starting to show their age), but I think this will make a useful addition. |
Thanks for your feedback! I just incorporated your comments and pushed a new commit. When I find myself some extra time, I'll start trying to write a lexer if that's OK. |
@@ -1,11 +1,9 @@ | |||
goog.require('ol.Feature'); | |||
goog.require('ol.Map'); | |||
goog.require('ol.RendererHint'); | |||
goog.require('ol.View2D'); |
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.
Now that ol.View2D
is gone, you'll want to change this to ol.View
.
@GingerIK you'll want to rebase this on master. git pull --rebase openlayers master
git push --force origin restore-wkt-parser (This assumes you've named the remote pointing to https://github.com/openlayers/ol3/ If you're comfortable with |
I'm comfortable with |
Very nice work on this @GingerIK. Thanks for all the effort. |
Back from the ashes! The WKT format lives!
My pleasure. |
This is a first attempt to restore the WKT parser.
It is probably preferred to rewrite the parser to the
ol.format
namespace as well,but I would first like to have some confirmation on this before doing so.