-
Notifications
You must be signed in to change notification settings - Fork 80
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
AtlasDelta and AtlasDeltaGenerator Revamp #195
Conversation
…that include before and after entities. Also, the generator CLI is not working.
Improved docs for making shaded JAR and setting up in IntelliJ IDEA. |
|
||
``` | ||
java -cp atlas-5.1.8-SNAPSHOT-shaded.jar org.openstreetmap.atlas.geography.atlas.delta.AtlasDeltaGenerator <args...> | ||
``` |
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.
Great README
addition.
if (afterEntity != null) | ||
{ | ||
final Map<String, String> afterTags = afterEntity.getTags(); | ||
afterTags.put("diff", "AFTER"); |
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.
It seems like this is the only difference between these code blocks. Maybe could move the if(null) check here and avoid duplicating a lot of this code?
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.
Great point, I will change this.
@@ -36,28 +36,29 @@ | |||
* Difference between two {@link Atlas}. | |||
* | |||
* @author matthieun | |||
* @author hallahan |
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.
Not sure a variable name change warrants an author tag ;)
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.
LOL, yeah, you're right! I'll take it out. I didn't realize I did it for that file.
*/ | ||
@Test | ||
public void parseGeoJson() | ||
{ |
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.
This functionality is going to be a huge win.
|
||
final AtlasDelta delta = new AtlasDelta(beforeAtlas, afterAtlas).generate(); | ||
|
||
final String txt = delta.toDiffViewFriendlyString(); |
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.
Nit: we try to avoid any and all abbreviations in atlas
. We would prefer text
over txt
. If I didn't say it I know @MikeGost would have :)
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.
Sounds good, I'll change that!
final AtlasDelta delta = new AtlasDelta(beforeAtlas, afterAtlas).generate(); | ||
|
||
final String txt = delta.toDiffViewFriendlyString(); | ||
final File txtFile = new File( |
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.
Same thing here.
@@ -1,6 +1,6 @@ | |||
# `PackedAtlas` | |||
|
|||
This is the base `Atlas`. It is immutable, and stores all its items in large arrays in memory. | |||
This is the before `Atlas`. It is immutable, and stores all its items in large arrays in memory. |
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.
I like the new before/after
naming choices over base/alter
.
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.
Cool, I was hoping it was ok.
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.
I really like these changes. Just see my minor nit about a variable name :)
private static final Switch<File> OUTPUT_FOLDER_SWITCH = new Switch<>("outputFolder", | ||
"The path of the output folder", string -> new File(string), Optionality.REQUIRED); | ||
private static final Switch<Path> OUTPUT_DIR_SWITCH = new Switch<>("outputDir", | ||
"The path of the output directory.", Paths::get, Optionality.REQUIRED); |
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.
Nit: outputDir -> outputDirectory. As @lucaspcram said we try to avoid abbreviations, even popular ones
Ok @lucaspcram and @jwpgage , ready for another review! |
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.
Nice changes @hallahan! Couple minor nits regarding abbreviations.
public void testGeoJson() | ||
{ | ||
final String geoJson = delta.toGeoJson(); | ||
final int len = geoJson.length(); |
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.
Nit: len --> length
public void testRelationsGeoJson() | ||
{ | ||
final String relationsGeoJson = delta.toRelationsGeoJson(); | ||
final int len = relationsGeoJson.length(); |
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.
Nit: same
Ok, @MikeGost , ready for review / merge? Fixed len abbrev. |
Looks good! I'm comfortable with the merge, wanted @matthieun to look at it first since he was original author. |
Ah sorry. Looks like I jumped the gun on this one. |
@MikeGost and @lucaspcram - I'll have another PR out today, and maybe @matthieun can chime in and I can make any changes needed there? |
@hallahan Sounds good! @lucaspcram you're fine! |
Description:
This PR re-implements AtlasDeltaGenerator, as the old implementation was not working. Now, this tool will generate GeoJSON both for the features as well as the relations. It will also output the text-based "diff view friendly string".
Potential Impact:
AtlasDelta is mainly used for testing and data verification.
Unit Test Approach:
Because this PR is focused on the GeoJSON generation, I have
AtlasDeltaGeoJsonIntegrationTest
generate GeoJSON and assert certain things about it such as:Test Results:
In addition, I have been running
AtlasDeltaGenerator
on various atlases (just shards), and then take the generated GeoJSON and look at it in JOSM.Note that I'm continuing with the existing approach where we separate relations from nodes and ways in the delta GeoJSONs. This helps reduce noise, because typically when a relation is modified, a lot of underlying geometry is affected.