forked from organicmaps/organicmaps
[generator:regions] Fix jsonl dref
This commit is contained in:
parent
b5872ebe5f
commit
90c18e1246
1 changed files with 8 additions and 6 deletions
|
@ -104,7 +104,6 @@ private:
|
|||
auto properties = base::NewJSONObject();
|
||||
|
||||
Localizator localizator(*properties);
|
||||
boost::optional<std::string> dref;
|
||||
|
||||
for (auto const & p : path)
|
||||
{
|
||||
|
@ -123,18 +122,21 @@ private:
|
|||
},
|
||||
"address");
|
||||
}
|
||||
|
||||
if (!dref && region.GetId() != main.GetId())
|
||||
dref = KeyValueStorage::SerializeDref(region.GetId().GetEncodedId());
|
||||
}
|
||||
|
||||
localizator.AddLocale("name", main);
|
||||
ToJSONObject(*properties, "rank", main.GetRank());
|
||||
|
||||
if (dref)
|
||||
ToJSONObject(*properties, "dref", *dref);
|
||||
if (path.size() > 1)
|
||||
{
|
||||
auto const & parent = (*(path.rbegin() + 1))->GetData();
|
||||
auto const parentId = parent.GetId().GetEncodedId();
|
||||
ToJSONObject(*properties, "dref", KeyValueStorage::SerializeDref(parentId));
|
||||
}
|
||||
else
|
||||
{
|
||||
ToJSONObject(*properties, "dref", base::NewJSONNull());
|
||||
}
|
||||
|
||||
auto const & country = path.front()->GetData();
|
||||
if (auto && isoCode = country.GetIsoCode())
|
||||
|
|
Loading…
Add table
Reference in a new issue