Skip to content

Commit

Permalink
Merge pull request #1 from remix/osm_tags
Browse files Browse the repository at this point in the history
Osm tags
  • Loading branch information
chelsey authored Jun 25, 2021
2 parents a554983 + b543d88 commit 4b4b477
Show file tree
Hide file tree
Showing 9 changed files with 3,185 additions and 1,920 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
group 'io.sharedstreets'
version '0.3.1'
version '0.3.2'


buildscript {
Expand Down
22 changes: 22 additions & 0 deletions src/main/java/io/sharedstreets/data/SharedStreetsOSMMetadata.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,11 @@ public class WaySectionMetadata implements Serializable {
public Long[] nodeIds;
public String name;

public String[] tagNames;
public String[] tagValues;

public WaySectionMetadata( WaySection section, boolean storeWaySegmentNames) {

this.wayId = section.wayId;

this.roadClass = section.roadClass;
Expand All @@ -42,6 +46,17 @@ public WaySectionMetadata( WaySection section, boolean storeWaySegmentNames) {
for(int i = 0; i < section.nodes.length; i++) {
this.nodeIds[i] = section.nodes[i].nodeId;
}

this.tagNames = new String[section.fields.keySet().size()];
this.tagValues = new String[section.fields.keySet().size()];

int i = 0;
for (String key : section.fields.keySet()) {
this.tagNames[i] = key;
this.tagValues[i] = section.fields.get(key);
i++;

}
}
}

Expand Down Expand Up @@ -81,6 +96,13 @@ public byte[] toBinary() throws IOException {
waySection.addNodeIds(nodeId);
}

for(int i = 0 ; i < waySectionMetadata.tagNames.length; i++) {
SharedStreetsProto.OsmTag.Builder tag = SharedStreetsProto.OsmTag.newBuilder();
tag.setKey(waySectionMetadata.tagNames[i]);
tag.setValue(waySectionMetadata.tagValues[i]);
waySection.addTags(tag);
}

osmMetadata.addWaySections(waySection);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,7 @@ public static UniqueId generateId(SharedStreetsReference ssr) {
}
}
UniqueId id = UniqueId.generateHash(hashString);

return id;
}

Expand Down
Loading

0 comments on commit 4b4b477

Please sign in to comment.