MCPcopy Create free account
hub / github.com/comaps/comaps / GetMatchingNodeFeatureFromOSM

Method GetMatchingNodeFeatureFromOSM

libs/editor/changeset_wrapper.cpp:165–190  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

163}
164
165editor::XMLFeature ChangesetWrapper::GetMatchingNodeFeatureFromOSM(m2::PointD const & center)
166{
167 // Match with OSM node.
168 ms::LatLon const ll = mercator::ToLatLon(center);
169 pugi::xml_document doc;
170 // Throws!
171 LoadXmlFromOSM(ll, doc);
172
173 pugi::xml_node const bestNode = matcher::GetBestOsmNode(doc, ll);
174 if (bestNode.empty())
175 {
176 MYTHROW(OsmObjectWasDeletedException,
177 ("OSM does not have any nodes at the coordinates", ll, ", server has returned:", doc));
178 }
179
180 if (!OsmFeatureHasTags(bestNode))
181 {
182 std::ostringstream sstr;
183 bestNode.print(sstr);
184 auto const strNode = sstr.str();
185 LOG(LDEBUG, ("Node has no tags", strNode));
186 MYTHROW(EmptyFeatureException, ("Node has no tags", strNode));
187 }
188
189 return {bestNode};
190}
191
192editor::XMLFeature ChangesetWrapper::GetMatchingAreaFeatureFromOSM(std::vector<m2::PointD> const & geometry)
193{

Callers 2

UploadChangesMethod · 0.80

Calls 5

GetBestOsmNodeFunction · 0.85
OsmFeatureHasTagsFunction · 0.85
printMethod · 0.80
ToLatLonFunction · 0.50
emptyMethod · 0.45

Tested by

no test coverage detected