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

Osm tags #1

Merged
merged 2 commits into from
Jun 25, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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