Skip to content

Commit

Permalink
Merge pull request #13 from sharedstreets/dev
Browse files Browse the repository at this point in the history
merge v0.3 changes roadClass filtering changes
  • Loading branch information
kpwebb authored Apr 15, 2018
2 parents e88db7b + 0586c7e commit fc9c3d5
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 8 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.1-SNAPSHOT'
version '0.3.0'


buildscript {
Expand Down
2 changes: 1 addition & 1 deletion settings.gradle
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
rootProject.name = 'osmlr'
rootProject.name = 'sharedstreets-builder'

6 changes: 3 additions & 3 deletions src/main/java/io/sharedstreets/tools/builder/ProcessPBF.java
Original file line number Diff line number Diff line change
Expand Up @@ -113,9 +113,9 @@ public static void main(String[] args) throws Exception {

// list of way classes for export tiles (must be in sequential order from least to most filtered)
ArrayList<Way.ROAD_CLASS> filteredClasses = new ArrayList<>();
filteredClasses.add(Way.ROAD_CLASS.ClassService);
filteredClasses.add(Way.ROAD_CLASS.ClassUnclassified);
filteredClasses.add(Way.ROAD_CLASS.ClassSecondary);
filteredClasses.add(Way.ROAD_CLASS.ClassTertiary);
filteredClasses.add(Way.ROAD_CLASS.ClassPrimary);
filteredClasses.add(Way.ROAD_CLASS.ClassMotorway);

for(Way.ROAD_CLASS filteredClass : filteredClasses) {
Expand All @@ -128,7 +128,7 @@ public static void main(String[] args) throws Exception {
// build internal model for street network
BaseSegments segments = new BaseSegments(filteredWays, intersections);

// build sharedstreets references, geometries, intersections and metadata
// build SharedStreets references, geometries, intersections and metadata
SharedStreetData streets = new SharedStreetData(segments);

ProtoTileOutputFormat outputFormat = new ProtoTileOutputFormat<Tuple2<TileId, TilableData>>(outputPath, filteredClass);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,17 @@ public Way.ROAD_CLASS getRoadClass() {
for(WaySection waySection : this.waySections) {
if(roadClass == null || roadClass == waySection.roadClass)
roadClass = waySection.roadClass;
else {
roadClass = Way.ROAD_CLASS.ClassOther;

// if mixed segment make segment class equal lowest class
// per https://github.com/sharedstreets/sharedstreets-ref-system/issues/20#issuecomment-378079937
// [excluded road]
// |
// [highway=primary] | [highway=secondary]
// ====================*=====================
// [roadClass=secondary]

else if(waySection.roadClass.getValue() > roadClass.getValue()){
roadClass = waySection.roadClass;
break;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ public void join(WayEntity first, Tuple2<Long, NodePosition[]> second, Collector
if(!way.isHighway())
return;

// don't include uncatorized highways
// don't include tags greater than filter value
if(way.roadClass().getValue() > filteredClass.getValue())
return;

Expand Down

0 comments on commit fc9c3d5

Please sign in to comment.