mirror of
https://codeberg.org/comaps/comaps
synced 2025-12-23 22:53:43 +00:00
Compare commits
7 Commits
60b1ad232a
...
generate-2
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a04b59b047 | ||
|
|
2bf22bd8a7 | ||
|
|
75f345288e | ||
|
|
85cb731693 | ||
|
|
3f9b6e82b5 | ||
|
|
dd204ae036 | ||
|
|
1bd734d417 |
@@ -105,17 +105,17 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
echo "Cloning $FORGEJO_SERVER_URL/$FORGEJO_REPOSITORY branch $FORGEJO_REF_NAME"
|
echo "Cloning $FORGEJO_SERVER_URL/$FORGEJO_REPOSITORY branch $FORGEJO_REF_NAME"
|
||||||
cd ~
|
cd ~
|
||||||
git clone --recurse-submodules --shallow-submodules -b $FORGEJO_REF_NAME --single-branch $FORGEJO_SERVER_URL/$FORGEJO_REPOSITORY.git comaps
|
git clone --depth 1 --recurse-submodules --shallow-submodules -b $FORGEJO_REF_NAME --single-branch $FORGEJO_SERVER_URL/$FORGEJO_REPOSITORY.git comaps
|
||||||
- name: Checkout wikiparser repo
|
- name: Checkout wikiparser repo
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
cd ~
|
cd ~
|
||||||
git clone https://codeberg.org/comaps/wikiparser.git
|
git clone --depth 1 --single-branch https://codeberg.org/comaps/wikiparser.git
|
||||||
- name: Checkout subways repo
|
- name: Checkout subways repo
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
cd ~
|
cd ~
|
||||||
git clone https://codeberg.org/comaps/subways.git
|
git clone --depth 1 --single-branch https://codeberg.org/comaps/subways.git
|
||||||
|
|
||||||
copy-coasts:
|
copy-coasts:
|
||||||
# if: inputs.run-copy-coasts
|
# if: inputs.run-copy-coasts
|
||||||
|
|||||||
@@ -11,6 +11,7 @@
|
|||||||
#include "base/assert.hpp"
|
#include "base/assert.hpp"
|
||||||
#include "base/buffer_vector.hpp"
|
#include "base/buffer_vector.hpp"
|
||||||
|
|
||||||
|
#include <execution>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <unordered_map>
|
#include <unordered_map>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
@@ -117,27 +118,31 @@ public:
|
|||||||
template <class FnT>
|
template <class FnT>
|
||||||
void ForEachEnter(FnT && fn) const
|
void ForEachEnter(FnT && fn) const
|
||||||
{
|
{
|
||||||
for (auto const & [key, transit] : m_transitions)
|
std::for_each(std::execution::par_unseq, m_transitions.begin(), m_transitions.end(), [&](auto const & pair)
|
||||||
{
|
{
|
||||||
|
auto const & [key, transit] = pair;
|
||||||
|
|
||||||
if (transit.m_forwardIsEnter)
|
if (transit.m_forwardIsEnter)
|
||||||
fn(transit.m_enterIdx, Segment(m_mwmId, key.m_featureId, key.m_segmentIdx, true));
|
fn(transit.m_enterIdx, Segment(m_mwmId, key.m_featureId, key.m_segmentIdx, true));
|
||||||
|
|
||||||
if (!transit.m_oneWay && !transit.m_forwardIsEnter)
|
if (!transit.m_oneWay && !transit.m_forwardIsEnter)
|
||||||
fn(transit.m_enterIdx, Segment(m_mwmId, key.m_featureId, key.m_segmentIdx, false));
|
fn(transit.m_enterIdx, Segment(m_mwmId, key.m_featureId, key.m_segmentIdx, false));
|
||||||
}
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class FnT>
|
template <class FnT>
|
||||||
void ForEachExit(FnT && fn) const
|
void ForEachExit(FnT && fn) const
|
||||||
{
|
{
|
||||||
for (auto const & [key, transit] : m_transitions)
|
std::for_each(std::execution::par_unseq, m_transitions.begin(), m_transitions.end(), [&](auto const & pair)
|
||||||
{
|
{
|
||||||
|
auto const & [key, transit] = pair;
|
||||||
|
|
||||||
if (!transit.m_forwardIsEnter)
|
if (!transit.m_forwardIsEnter)
|
||||||
fn(transit.m_exitIdx, Segment(m_mwmId, key.m_featureId, key.m_segmentIdx, true));
|
fn(transit.m_exitIdx, Segment(m_mwmId, key.m_featureId, key.m_segmentIdx, true));
|
||||||
|
|
||||||
if (!transit.m_oneWay && transit.m_forwardIsEnter)
|
if (!transit.m_oneWay && transit.m_forwardIsEnter)
|
||||||
fn(transit.m_exitIdx, Segment(m_mwmId, key.m_featureId, key.m_segmentIdx, false));
|
fn(transit.m_exitIdx, Segment(m_mwmId, key.m_featureId, key.m_segmentIdx, false));
|
||||||
}
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void GetOutgoingEdgeList(Segment const & segment, EdgeListT & edges) const
|
void GetOutgoingEdgeList(Segment const & segment, EdgeListT & edges) const
|
||||||
|
|||||||
@@ -4,16 +4,14 @@
|
|||||||
#include "routing/routing_options.hpp"
|
#include "routing/routing_options.hpp"
|
||||||
#include "routing/world_graph.hpp"
|
#include "routing/world_graph.hpp"
|
||||||
|
|
||||||
#include "platform/settings.hpp"
|
|
||||||
|
|
||||||
#include "base/assert.hpp"
|
#include "base/assert.hpp"
|
||||||
#include "base/checked_cast.hpp"
|
#include "base/checked_cast.hpp"
|
||||||
#include "base/exception.hpp"
|
|
||||||
#include "base/timer.hpp"
|
#include "base/timer.hpp"
|
||||||
|
|
||||||
#include "geometry/distance_on_sphere.hpp"
|
#include "geometry/distance_on_sphere.hpp"
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
#include <execution>
|
||||||
#include <limits>
|
#include <limits>
|
||||||
#include <utility>
|
#include <utility>
|
||||||
|
|
||||||
@@ -321,7 +319,9 @@ void IndexGraph::ReconstructJointSegment(astar::VertexData<JointSegment, RouteWe
|
|||||||
|
|
||||||
auto const & weightTimeToParent = parentVertexData.m_realDistance;
|
auto const & weightTimeToParent = parentVertexData.m_realDistance;
|
||||||
auto const & parentJoint = parentVertexData.m_vertex;
|
auto const & parentJoint = parentVertexData.m_vertex;
|
||||||
for (size_t i = 0; i < firstChildren.size(); ++i)
|
|
||||||
|
auto const range = std::ranges::views::iota(0uz, firstChildren.size());
|
||||||
|
std::for_each(std::execution::par_unseq, range.begin(), range.end(), [&, this](auto const i)
|
||||||
{
|
{
|
||||||
auto const & firstChild = firstChildren[i];
|
auto const & firstChild = firstChildren[i];
|
||||||
auto const lastPointId = lastPointIds[i];
|
auto const lastPointId = lastPointIds[i];
|
||||||
@@ -335,22 +335,21 @@ void IndexGraph::ReconstructJointSegment(astar::VertexData<JointSegment, RouteWe
|
|||||||
{ return currentPointId < lastPointId ? pointId + 1 : pointId - 1; };
|
{ return currentPointId < lastPointId ? pointId + 1 : pointId - 1; };
|
||||||
|
|
||||||
if (IsAccessNoForSure(firstChild.GetFeatureId(), weightTimeToParent, true /* useAccessConditional */))
|
if (IsAccessNoForSure(firstChild.GetFeatureId(), weightTimeToParent, true /* useAccessConditional */))
|
||||||
continue;
|
return;
|
||||||
|
|
||||||
if (IsAccessNoForSure(parent.GetRoadPoint(isOutgoing), weightTimeToParent, true /* useAccessConditional */))
|
if (IsAccessNoForSure(parent.GetRoadPoint(isOutgoing), weightTimeToParent, true /* useAccessConditional */))
|
||||||
continue;
|
return;
|
||||||
|
|
||||||
if (IsUTurn(parent, firstChild) && IsUTurnAndRestricted(parent, firstChild, isOutgoing))
|
if (IsUTurn(parent, firstChild) && IsUTurnAndRestricted(parent, firstChild, isOutgoing))
|
||||||
continue;
|
return;
|
||||||
|
|
||||||
if (IsRestricted(parentJoint, parent.GetFeatureId(), firstChild.GetFeatureId(), isOutgoing, parents))
|
if (IsRestricted(parentJoint, parent.GetFeatureId(), firstChild.GetFeatureId(), isOutgoing, parents))
|
||||||
continue;
|
return;
|
||||||
|
|
||||||
RouteWeight summaryWeight;
|
RouteWeight summaryWeight;
|
||||||
// Check current JointSegment for bad road access between segments.
|
// Check current JointSegment for bad road access between segments.
|
||||||
RoadPoint rp = firstChild.GetRoadPoint(isOutgoing);
|
RoadPoint rp = firstChild.GetRoadPoint(isOutgoing);
|
||||||
uint32_t start = currentPointId;
|
uint32_t start = currentPointId;
|
||||||
bool noRoadAccess = false;
|
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
// This is optimization: we calculate accesses of road points before calculating weight of
|
// This is optimization: we calculate accesses of road points before calculating weight of
|
||||||
@@ -360,19 +359,13 @@ void IndexGraph::ReconstructJointSegment(astar::VertexData<JointSegment, RouteWe
|
|||||||
// until this |rp|. But we assume that segments have small length and inaccuracy will not
|
// until this |rp|. But we assume that segments have small length and inaccuracy will not
|
||||||
// affect user.
|
// affect user.
|
||||||
if (IsAccessNoForSure(rp, weightTimeToParent, true /* useAccessConditional */))
|
if (IsAccessNoForSure(rp, weightTimeToParent, true /* useAccessConditional */))
|
||||||
{
|
return;
|
||||||
noRoadAccess = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
start = increment(start);
|
start = increment(start);
|
||||||
rp.SetPointId(start);
|
rp.SetPointId(start);
|
||||||
}
|
}
|
||||||
while (start != lastPointId);
|
while (start != lastPointId);
|
||||||
|
|
||||||
if (noRoadAccess)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
bool forward = currentPointId < lastPointId;
|
bool forward = currentPointId < lastPointId;
|
||||||
Segment current = firstChild;
|
Segment current = firstChild;
|
||||||
Segment prev = parent;
|
Segment prev = parent;
|
||||||
@@ -396,7 +389,7 @@ void IndexGraph::ReconstructJointSegment(astar::VertexData<JointSegment, RouteWe
|
|||||||
|
|
||||||
jointEdges.emplace_back(isOutgoing ? JointSegment(firstChild, prev) : JointSegment(prev, firstChild),
|
jointEdges.emplace_back(isOutgoing ? JointSegment(firstChild, prev) : JointSegment(prev, firstChild),
|
||||||
summaryWeight);
|
summaryWeight);
|
||||||
}
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void IndexGraph::GetNeighboringEdge(astar::VertexData<Segment, RouteWeight> const & fromVertexData, Segment const & to,
|
void IndexGraph::GetNeighboringEdge(astar::VertexData<Segment, RouteWeight> const & fromVertexData, Segment const & to,
|
||||||
|
|||||||
@@ -18,8 +18,6 @@
|
|||||||
|
|
||||||
#include "indexer/feature_meta.hpp"
|
#include "indexer/feature_meta.hpp"
|
||||||
|
|
||||||
#include "geometry/point2d.hpp"
|
|
||||||
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <optional>
|
#include <optional>
|
||||||
#include <unordered_map>
|
#include <unordered_map>
|
||||||
|
|||||||
@@ -13,6 +13,7 @@
|
|||||||
#include "3party/skarupke/bytell_hash_map.hpp" // needed despite of IDE warning
|
#include "3party/skarupke/bytell_hash_map.hpp" // needed despite of IDE warning
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
#include <execution>
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <optional>
|
#include <optional>
|
||||||
#include <queue>
|
#include <queue>
|
||||||
@@ -474,7 +475,8 @@ void IndexGraphStarterJoints<Graph>::GetEdgeList(astar::VertexData<Vertex, Weigh
|
|||||||
CHECK(it != m_savedWeight.cend(), ("Can not find weight for:", vertex));
|
CHECK(it != m_savedWeight.cend(), ("Can not find weight for:", vertex));
|
||||||
|
|
||||||
Weight const weight = it->second;
|
Weight const weight = it->second;
|
||||||
for (size_t i = 0; i < edges.size(); ++i)
|
auto const range = std::ranges::views::iota(0uz, edges.size());
|
||||||
|
std::for_each(std::execution::par_unseq, range.begin(), range.end(), [&, this](auto const i)
|
||||||
{
|
{
|
||||||
// Saving weight of current edges for returning in the next iterations.
|
// Saving weight of current edges for returning in the next iterations.
|
||||||
auto & w = edges[i].GetWeight();
|
auto & w = edges[i].GetWeight();
|
||||||
@@ -490,7 +492,7 @@ void IndexGraphStarterJoints<Graph>::GetEdgeList(astar::VertexData<Vertex, Weigh
|
|||||||
// |parentWeights[]|. So the weight of an ith edge is a cached "weight of parent JointSegment" +
|
// |parentWeights[]|. So the weight of an ith edge is a cached "weight of parent JointSegment" +
|
||||||
// "parentWeight[i]".
|
// "parentWeight[i]".
|
||||||
w = weight + parentWeights[i];
|
w = weight + parentWeights[i];
|
||||||
}
|
});
|
||||||
|
|
||||||
// Delete useless weight of parent JointSegment.
|
// Delete useless weight of parent JointSegment.
|
||||||
m_savedWeight.erase(vertex);
|
m_savedWeight.erase(vertex);
|
||||||
@@ -498,8 +500,9 @@ void IndexGraphStarterJoints<Graph>::GetEdgeList(astar::VertexData<Vertex, Weigh
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
// This needs for correct weights calculation of FakeJointSegments during forward A* search.
|
// This needs for correct weights calculation of FakeJointSegments during forward A* search.
|
||||||
for (size_t i = firstFakeId; i < edges.size(); ++i)
|
auto const range = std::ranges::views::iota(firstFakeId, edges.size());
|
||||||
edges[i].GetWeight() += parentWeights[i];
|
std::for_each(std::execution::par_unseq, range.begin(), range.end(),
|
||||||
|
[&edges, &parentWeights](auto const i) { edges[i].GetWeight() += parentWeights[i]; });
|
||||||
}
|
}
|
||||||
|
|
||||||
auto const vertexMwmId = vertex.GetMwmId();
|
auto const vertexMwmId = vertex.GetMwmId();
|
||||||
@@ -510,12 +513,12 @@ void IndexGraphStarterJoints<Graph>::GetEdgeList(astar::VertexData<Vertex, Weigh
|
|||||||
/// a weight of v1->v2 transition moving backward (v2 ingoing). This is impossible in current (m_savedWeight)
|
/// a weight of v1->v2 transition moving backward (v2 ingoing). This is impossible in current (m_savedWeight)
|
||||||
/// logic, so I moved Cross-MWM penalty into separate block here after _all_ weights calculations.
|
/// logic, so I moved Cross-MWM penalty into separate block here after _all_ weights calculations.
|
||||||
|
|
||||||
for (auto & e : edges)
|
std::for_each(std::execution::par_unseq, edges.begin(), edges.end(), [&, this](auto & e)
|
||||||
{
|
{
|
||||||
auto const targetMwmId = e.GetTarget().GetMwmId();
|
auto const targetMwmId = e.GetTarget().GetMwmId();
|
||||||
if (targetMwmId != kFakeNumMwmId && vertexMwmId != targetMwmId)
|
if (targetMwmId != kFakeNumMwmId && vertexMwmId != targetMwmId)
|
||||||
e.GetWeight() += m_graph.GetCrossBorderPenalty(vertexMwmId, targetMwmId);
|
e.GetWeight() += m_graph.GetCrossBorderPenalty(vertexMwmId, targetMwmId);
|
||||||
}
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ def multithread_run_if_one_country(func):
|
|||||||
kwargs.update({"threads_count": settings.THREADS_COUNT})
|
kwargs.update({"threads_count": settings.THREADS_COUNT})
|
||||||
# Otherwise index stage of Taiwan_* mwms continues to run after all other mwms have finished:
|
# Otherwise index stage of Taiwan_* mwms continues to run after all other mwms have finished:
|
||||||
elif country == 'Taiwan_North':
|
elif country == 'Taiwan_North':
|
||||||
kwargs.update({"threads_count": 6})
|
kwargs.update({"threads_count": 3})
|
||||||
elif country == 'Taiwan_South':
|
elif country == 'Taiwan_South':
|
||||||
kwargs.update({"threads_count": 2})
|
kwargs.update({"threads_count": 2})
|
||||||
func(env, country, **kwargs)
|
func(env, country, **kwargs)
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ MAIN_OUT_PATH: /mnt/4tbexternal/osm-maps
|
|||||||
# Path to the data/ folder in the repository:
|
# Path to the data/ folder in the repository:
|
||||||
USER_RESOURCE_PATH: ${Developer:OMIM_PATH}/data
|
USER_RESOURCE_PATH: ${Developer:OMIM_PATH}/data
|
||||||
# Features stage only parallelism level. Set to 0 for auto detection.
|
# Features stage only parallelism level. Set to 0 for auto detection.
|
||||||
THREADS_COUNT_FEATURES_STAGE: 0
|
THREADS_COUNT_FEATURES_STAGE: 64
|
||||||
# Do not change it. This is determined automatically.
|
# Do not change it. This is determined automatically.
|
||||||
NODE_STORAGE: mem
|
NODE_STORAGE: mem
|
||||||
|
|
||||||
|
|||||||
@@ -31,22 +31,22 @@ python3 -m venv /tmp/venv
|
|||||||
echo "<$(date +%T)> Copying map generator INI..."
|
echo "<$(date +%T)> Copying map generator INI..."
|
||||||
cp var/etc/map_generator.ini.prod var/etc/map_generator.ini
|
cp var/etc/map_generator.ini.prod var/etc/map_generator.ini
|
||||||
|
|
||||||
$GENARGS=""
|
GENARGS=""
|
||||||
|
|
||||||
if [ $MWMTEST -gt 0 ]; then
|
if [ $MWMTEST == "true" ]; then
|
||||||
echo "Marking as a test (non-prod) generation"
|
echo "Marking as a test (non-prod) generation"
|
||||||
# TODO: output test maps into e.g. osm-maps-test/ and use a different generation.log
|
# TODO: output test maps into e.g. osm-maps-test/ and use a different generation.log
|
||||||
$GENARGS="$GENARGS -s=test"
|
GENARGS="$GENARGS -s=test"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ $MWMCONTINUE -gt 0 ]; then
|
if [ $MWMCONTINUE == "true" ]; then
|
||||||
echo "Continuing from preexisting generator run"
|
echo "Continuing from preexisting generator run"
|
||||||
$GENARGS="$GENARGS --continue"
|
GENARGS="$GENARGS --continue"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ -n $MWMCOUNTRIES ]]; then
|
if [[ -n $MWMCOUNTRIES ]]; then
|
||||||
echo "Generating only specific maps for [$MWMCOUNTRIES]"
|
echo "Generating only specific maps for [$MWMCOUNTRIES]"
|
||||||
$GENARGS="$GENARGS --countries=$MWMCOUNTRIES"
|
GENARGS="$GENARGS --countries=$MWMCOUNTRIES"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
cd ~/comaps/tools/python
|
cd ~/comaps/tools/python
|
||||||
|
|||||||
Reference in New Issue
Block a user