oshdb icon indicating copy to clipboard operation
oshdb copied to clipboard

Core OSHDB classes need javadoc

Open SlowMo24 opened this issue 6 years ago • 7 comments

For unexperienced developers this: https://github.com/GIScience/oshdb/blob/master/oshdb/src/main/java/org/heigit/bigspatialdata/oshdb/osh/OSHRelation.java#L306 needs to get javadoc!

A) is this the right way to create an OSHEntity (in this example Type: Relation) B) What are "nodes" and "ways"? All ways that were ever part of of the OSHRelation or just the current ones?

SlowMo24 avatar Feb 05 '19 20:02 SlowMo24

A.) Yes, for the current version this is the right way to create an OSHEntity.

long id = osm_id;
List<OSMRelations> versions = ...;
List<OSHNode> relationNodes = ...;
List<OSHWay relationWays = ...;
long baseId = 0L;
long baseTimestamp = 0L;
long baseLongitude = 0L;
long baseLatitude = 0L;
ByteBuffer record = OSHRelation.buildRecord(id, relation, relationNodes, relationWays,baseId, baseTimestamp, baseLongitude, baseLatitude);

B.) this question is a little bit confusing. What are the "just the current ones", for an OSHRelation?

rtroilo avatar Feb 06 '19 09:02 rtroilo

A) could you please point me to where I can find the OSHRelation.buildRecord() method? Am I missing something? I was looking at

OSHRelation oshr=OSHRelation.build(List<OSMRelation> versions,Collection<OSHNode> nodes, Collection<OSHWay> ways)

B) that is also where I need clarification: what is meant by e.g. Collection<OSHNode> nodes? The OSHObject of the Nodes being part of the Relation or also those that might have bin deleted over time (i.e. in earlier version of the the OSHRelation)?

SlowMo24 avatar Feb 06 '19 09:02 SlowMo24

A), this is basically the same as the code snippet I show you. buildRecord is a new version in an side branch, but it is the same as build.

B) we talk about OSHObjects, H for history, so all information over time are relevant :-) in this case, all OSHNodes (which are or were part of the OSHRelation as member) and all OSHWays (which are or were part of the OSHRelation as member)

rtroilo avatar Feb 06 '19 09:02 rtroilo

:+1: thanks for clarification. I will leave it open because javadoc is still missing (and promised with new version :joy: )

SlowMo24 avatar Feb 06 '19 10:02 SlowMo24

(please try to use more specific issue titles 🙏 )

tyrasd avatar Feb 06 '19 17:02 tyrasd

Sorry for coming back again. Maybe I am not getting this right again, but aren't we doubling things here?

Each element of List<OSMRelation> versions fed to the builder contains an element OSMMember[] refs . Each value of that array in turn contains an element OSHEntity entity . So IF I get this right the exact content of Collection<OSHNode> nodes is already present within List<OSMRelation> versions and the user has to provide the same information twice?

SlowMo24 avatar Feb 06 '19 21:02 SlowMo24

Not necessarily, OSMMember.getEntity() could be null and it fact it is null, in the moment of an import. That's the reason for the separate list. But yes, if you get a new version for an relation, you could get all OSHNodes/Ways out of the members of the OSHRelation but only if the new version do not introduce an new member.

rtroilo avatar Feb 06 '19 21:02 rtroilo