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

Annotation geojson #617

Merged
merged 10 commits into from
Oct 12, 2016
Merged

Annotation geojson #617

merged 10 commits into from
Oct 12, 2016

Conversation

manthey
Copy link
Contributor

@manthey manthey commented Sep 26, 2016

Annotation layers can output and input geojson. Using its own geojson will reconstruct the annotations (though they may have different internal IDs). Modifying the geojson updates the annotations.

The annotation example has the ability to live-edit the geojson.

This requires PR #616.

The order is not guaranteed to be the same as the exported order; points will end up before rectangles and polygons due to grouping by the geojson reader.
You can edit the geojson live.
@codecov-io
Copy link

codecov-io commented Sep 26, 2016

Current coverage is 85.39% (diff: 100%)

Merging #617 into master will increase coverage by 2.58%

@@             master       #617   diff @@
==========================================
  Files            85         85          
  Lines          8019       8211   +192   
  Methods           0          0          
  Messages          0          0          
  Branches          0          0          
==========================================
+ Hits           6641       7012   +371   
+ Misses         1378       1199   -179   
  Partials          0          0          

Powered by Codecov. Last update 30e8bcf...991d29f

@manthey manthey changed the title [WIP] Annotation geojson Annotation geojson Sep 29, 2016
@manthey
Copy link
Contributor Author

manthey commented Sep 29, 2016

@aashish24 This is ready for review.

@aashish24
Copy link
Member

Cool! Will review it soon, thanks 👏 👏

Copy link
Member

@aashish24 aashish24 left a comment

Choose a reason for hiding this comment

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

The code looks reasonable to me, I also tried to manipulate geojson many times and after some initial glitch (not able to reproduce), things worked great to me! Just has some very minor questions.

@@ -8,7 +8,7 @@ var exampleUtils = {
'&').map(function (n) {
n = n.split('=');
if (n[0]) {
this[decodeURIComponent(n[0])] = decodeURIComponent(n[1]);
this[decodeURIComponent(n[0].replace(/\+/g, '%20'))] = decodeURIComponent(n[1].replace(/\+/g, '%20'));
Copy link
Member

Choose a reason for hiding this comment

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

why this was needed?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

decodeURIComponent doesn't decode + to a space in Chrome, but urls are allowed to use + to encode spaces.

* annotations and leave unchanged annotations.
* @param {string|geo.transform} [gcs] undefined to use the interface gcs,
* null to use the map gcs, or any other transform.
* @param {boolean} includeCrs: if true, include the coordinate system in the
Copy link
Member

@aashish24 aashish24 Sep 30, 2016

Choose a reason for hiding this comment

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

should we rename includeCrs to includeGcs to be consistent?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

In geojson it is called crs. Since this affects the geojson output, I figured it should be crs in this context, not gcs.

Copy link
Member

Choose a reason for hiding this comment

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

okay thats fine, I just thought that everywhere else we used gcs but I don't have strong feeling about it.

@manthey manthey merged commit 2ee4693 into master Oct 12, 2016
@manthey manthey deleted the annotation-geojson branch October 12, 2016 17:57
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.

3 participants