WIP: Hyphenate interpolated addresses #8683

Draft
zyphlar wants to merge 1 commit from zyphlar/hyphenate_interpolated_addresses into master
3 changed files with 21 additions and 3 deletions

View file

@ -302,7 +302,7 @@ ftypes::LocalityType GetLocalityIndex(feature::TypesHolder const & types)
// TODO: Format street and house number according to local country's rules.
string FormatStreetAndHouse(ReverseGeocoder::Address const & addr)
{
return addr.GetStreetName() + ", " + addr.GetHouseNumber();
return addr.GetStreetName() + ", " + addr.GetReadableHouseNumber();
}
// TODO: Share common formatting code for search results and place page.
@ -494,7 +494,7 @@ private:
{
string streetName;
m_ranker.GetBestMatchName(*streetFeature, streetName);
name = streetName + ", " + addr.GetHouseNumber();
name = streetName + ", " + addr.GetReadableHouseNumber();
}
}
}

View file

@ -11,6 +11,7 @@
#include <optional>
#include <string>
#include <vector>
#include <regex>
class FeatureType;
class DataSource;
@ -86,6 +87,15 @@ public:
Building m_building;
Street m_street;
std::string const GetReadableHouseNumber() const {
std::string out;
if (GetHouseNumber().find(':') != std::string::npos)
// Instead of 123:456 for house number ranges, do 123 - 456 except with thin spaces and an en-dash
out = std::regex_replace(GetHouseNumber(), std::regex("^(\\d+):(\\d+)$"), "$1$2");
else
out = GetHouseNumber();
return (std::string const)out;
}
std::string const & GetHouseNumber() const { return m_building.m_name; }
std::string const & GetStreetName() const { return m_street.m_name; }
double GetDistance() const { return m_building.m_distanceMeters; }

View file

@ -67,7 +67,7 @@ python -m maps_generator --countries="Macedonia" --skip="Coastline"
It's possible to skip coastlines for countries that have a sea coast too, but the sea water will not be rendered in that case.
Make sure that requested countries are contained in your planet dump file indeed. Filenames in `data/borders/` (without the `.poly` extension) represent all valid country names.
Make sure that you specify country names that are actually contained in your pbf file, or you'll get errors in the next step. Check the filenames in the `data/borders/` folder (without the `.poly` extension) for a list of all valid country names. For example, New York City is in `US_New York_New_York` and all of England (minus Ireland, Scotland, and Wales) can be generated by specifying `UK_England_*`.
biodranik commented 2024-08-26 07:48:12 +00:00 (Migrated from github.com)
Review

Please make a separate PR with documentation.

Please make a separate PR with documentation.
To see other possible command-line options:
```sh
@ -76,6 +76,14 @@ python -m maps_generator -h
If you are not from the Organic Maps team, then you do not need the `--production` option.
## Installing
Generated mwm files will appear in the MAIN_OUT_PATH from your INI configuration, which is by default a new `om_maps_build` folder next to your organicmaps folder.
You can install the mwm files in many ways:
- Android
- Use development tools like Android Studio's Device Explorer or adb to copy the mwm files to a path like `/sdcard/Android/data/app.organicmaps.debug/123456/Your_Country_Here.mwm`
## Troubleshooting
The general log file (by default its `maps_build/generation.log`) contains output of the `maps_generator` python script only. More detailed logs that include output of the `generator_tool` binary are located in the `logs/` subdir of a particular build directory, e.g. `maps_build/2023_06_04__20_05_07/logs/`.