osmandapp / OsmAnd

OsmAnd
https://osmand.net
Other
4.54k stars 1k forks source link

Import Favorites from GPX doesn't apply default appearance Favorite group #19971

Open suntri-star opened 2 months ago

suntri-star commented 2 months ago

Favorite issues related to iOverlander. www.ioverlander.com

For example, I select a country and get a GPX file. I can open that and OSMand imports it beautifully.

A separate directory is created for each type. I can then assign each “group” its own color and/or icon if desired.

So far everything is good.

1.) If I now import another country, the same “groups” in favorites are filled with additional data. That's still ok too. But the new points then have the standard colors and icon and not those assigned with the “group”. Does anyone have a solution for this?

2.) Unfortunately now things are getting even worse. After some time, I've been traveling for a while, I reload the same country. Then the identical points appear twice and unfortunately with the default settings. Unfortunately it is not recognized that a point already exists. Unfortunately, my approach is very laborious: I first completely delete all iOverlander groups, as unfortunately I cannot delete them individually for each country, and then import everything again. Then assign my icon and colors and 2 weeks later I'm annoyed about the same effort. Does anyone have a better way to do this?

THANKS for every hint

mariush444 commented 2 months ago

Please verify if you have osmand definition at the end of the gpx file. Something like

<extensions>
    <osmand:points_groups>
      <group name="Official Campground" color="#1010a0" icon="building_type_pyramid" background="circle" />
      <group name="Informal Campsite" color="#1010a0" icon="special_star" background="circle" />
      <group name="Wild Camping" color="#1010a0" icon="special_star_stroked" background="circle" />
      <group name="Hotel" color="#1010a0" icon="tourism_hotel" background="circle" />
suntri-star commented 2 months ago

places20240528-186-aihxsw.gpx.txt

try three

suntri-star commented 2 months ago

I assign the colors and icon after the import. “Categories” are created under points as shown in the picture. If I import the newer file later, the points fall into the same categories. That's good. But they don't have the color and icon like the existing ones. And if there is an identical point, you won't be asked whether you should skip it or overwrite it. The dot will then appear twice. And if I do it again three dots appear.

I also can't delete an old import or a country. Only everything or categories. A pity.

mariush444 commented 2 months ago

Generally (in my opinion based on observation and practse) When you got exported data from iO to gpx file don't import it to osmand. Osmand during import makes some coversion and import waypoint to its internal DB that is not optimalized to big number of favorities and doesn't recognize duplicates Beter method is to copy gpx to osmand's tracks folder. (I hope you have access to the folder and you know how to do it). After coping you can activate it as any other gpx in menu favorities -> tab tracks -> 3dots -> show on the map. In the track menu "points" you have possibility to activate/deactivate groups in gpx fastly and change icon/colors for group and/or waypoint. When you have new gpx then do the same what you have done with previous one but deactivate the previous file. Thats all.

Problem with icon/color for group. Befor coping gpx into folder edit gpx file and put my code at the very end of the file before last tag .

</wpt> <- the last wpt <- put the code here </gpx> <- the last tag in the file

Of course, this is my proposition of icons and colors. You can change as you want.

PS. Please notice that exported file from iO contains only the 1st note about a waypoint. Any added info are ommited during export by iO, so it means that you haven't newest info in osmand. You have to use iO still.


<extensions>
      <osmand:points_groups>
        <group name="Official Campground" color="#1010a0" icon="building_type_pyramid" background="circle" />
        <group name="Informal Campsite" color="#1010a0" icon="special_star" background="circle" />
        <group name="Wild Camping" color="#1010a0" icon="special_star_stroked" background="circle" />
        <group name="Hotel" color="#1010a0" icon="tourism_hotel" background="circle"/>
        <group name="Hostel" color="#1010a0" icon="tourism_hostel" background="circle"/>
        <group name="Propane" color="#10c0f0" icon="gas" background="circle"/>
        <group name="Mechanic and Parts" color="#a71de1" icon="shop_car_repair" background="circle" />
        <group name="Water" color="#10c0f0" icon="water_tap" background="circle" />
        <group name="Restaurant" color="#10c0f0" icon="restaurants" background="circle" />
        <group name="Customs and Immigration" color="#a71de1" icon="barrier_border_control" background="circle"/>
        <group name="Other" color="##dfc520" icon="special_flag" background="circle"/>
        <group name="Fuel Station" color="#a71de1" icon="fuel" background="circle" />
        <group name="Tourist Attraction" color="#d00d0d" icon="special_star_stroked" background="circle" />
        <group name="Sanitation Dump Station"  color="#10c0f0" icon="sanitary_dump_station" background="circle" />
        <group name="Consulate / Embassy" color="#a71de1" icon="barrier_border_control" background="circle"/>
        <group name="Vehicle Insurance" color="#a71de1" icon="insurance" background="circle"/>
        <group name="Vehicle Shipping" color="#a71de1" icon="route_ferry_ref" background="circle" />
        <group name="Checkpoint" color="#a71de1" icon="amenity_police" background="circle" />
        <group name="Warning" color="#000001" icon="special_symbol_exclamation_mark" background="circle" />
        <group name="Shopping" color="#10c0f0" icon="shop_supermarket" background="circle" />
        <group name="Medical" color="#10c0f0" icon="clinic" background="circle"/>
        <group name="Pet Services" color="#10c0f0" icon="pet_grooming" background="circle"/>
        <group name="Laundry" color="#10c0f0" icon="shop_laundry" background="circle"/>
        <group name="Laundromat" color="#10c0f0" icon="shop_laundry" background="circle" />
        <group name="Vehicle Storage" color="#a71de1" icon="parking_multi_storey" background="circle"/>
        <group name="Short-term Parking" color="#a71de1" icon="amenity_parking_paid" background="circle" />
        <group name="Eco-Friendly" color="#dfc520" icon="special_flag" background="circle"/>
        <group name="Financial" color="#10c0f0" icon="amenity_atm" background="circle"/>
        <group name="Wifi" color="#10c0f0" icon="internet_access_wlan" background="circle" />
        <group name="Showers" color="#10c0f0" icon="shower" background="circle"/>
      </osmand:points_groups>
    </extensions>
suntri-star commented 2 months ago

Thanks for the answer to my question. I've tried this before and wasn't happy with it. Now I will test it again with the additional code. I hope this gets better. Of course, this approach is no longer applicable for every user. I'll report back with my results. THANKS

suntri-star commented 2 months ago

It looks bad. I am quite sure that the directory where the GPX files are located was accessed months ago. But access is no longer possible. I can't copy files there. I don't see it anymore either. Something must have changed. I tried moving OSMand from the location. Unfortunately that didn't help.

mariush444 commented 2 months ago

What Android version do you have? What phone (samsung, xiaomi ....)? Can you show "data storage folder" in osmand settings?

Can you install Mixplorer from gplay or github or other app https://play.google.com/store/apps/details?id=org.aospstudio.files

(This app is link to embeded andriod file menager that should show more than usually . You will see it in app list as second file manager)

suntri-star commented 2 months ago

I've come a little further. I have access to the directory using Android's file manager. This was not possible with another file manager. Strange. Now I have already put a modified GPX file in the directory. I see the dots on the map. Unfortunately all with standard icon and color. Now I'll look again at what you wrote above and implement it exactly the same way. I'll get in touch

suntri-star commented 2 months ago

first copied the gpx files to obb/net.osmand.plus/tracks/import. I could turn it on and off. However, everything is red and normal icon. I think that was the wrong place. So I moved it to obb/net.osmand.plus/favorites/. I also see 4 groups that I know. But after starting up I don't see the new GPX files for selection? Which is the right place?

mariush444 commented 2 months ago

Can you attach you gpx file?

suntri-star commented 2 months ago

io-botswana.gpx.txt

Here the file

sonora commented 2 months ago

Cross-link to https://github.com/osmandapp/OsmAnd/issues/19892#issuecomment-2143025596, closely related.

There seems currently a bug, probably a regression, to the effect that the point group appearacne extension at the end of GPX files is not properly handled (or perhaps ignored) when displaying the waypoint icons.

mariush444 commented 2 months ago

Yes, I noticed that and try to prepare python script for you to solve it (workaround). The queation is if you can use python? (e.g. pytdroid on android or python on pc)

sonora commented 2 months ago

@Chumva Perhaps your work on GPX appearance nid April may be related? We need to somehow have a logic where the gpx appearance extensions (tags color, icon, background) are honored in this priority order:

  1. Highest priority: user's appearance setting in OsmAnd (only if/once specifically set), overrules
  2. file-internal specification from extension directly in each point's <wpt> section, overrules
  3. applicable file-internal group specification from osmand:points_groups extension, overrules
  4. Osmand's rendering default

Code ref, as found for the Editor, already partially honoring this: https://github.com/osmandapp/OsmAnd/blob/928a0768ad13046490e1d4a52d6b0c9bba2ca587/OsmAnd/src/net/osmand/plus/mapcontextmenu/editors/WptPtEditorFragment.java#L368

But I cannot find such group color detection code outside the Editor function, and even there the identifcation of the groups seems buggy, as all wpts fall back to the favorite default color after exiting/canceling the edit dialog.

suntri-star commented 2 months ago

I don't want an intermediate solution with Python. I hope the bug can be fixed in the next version. My next trip is scheduled to start at the end of July. It would be nice if it could work until then. Otherwise, I'll do the import as before, unfortunately with a lot of effort.

vshcherb commented 2 months ago

@sonora GPX-specific settings only apply latest if all other are default. Also in application you can reset folder or specific track to "default view".

Please note that we didn't implement yet Default Favorite appearance as we planned to make it similar to GPX Folder default settings.

mariush444 commented 2 months ago

@suntri-star Anyway I've already done it so maybe it will be helpful for others.


how to run copy gpx from iOverlander and the script into the same directory in Pydroid 3 (from Google play store) from menu choose option Terminal change directory to the script (use command: cd PATH) run scrpit (use command: ./io2osm.py)

when finnished, you find new gpx file in the directory


how to modify

open script in text editor change input and output file to convert other files

you can modify icons, shape and colors as you need it is just my proposition BUT you have to change item twice 1st occurence is for waypoints - line starts with: replace(' 2nd occurence is for group - line starts with: '<group name="

it is not optimalized but I'm on a trip and I have smartphon only with me and I tested one file only that I got from you.

icons that you can use are in pdf https://github.com/mariush444/gmapIcons2osmand/blob/main/icons-gmap-osmand.pdf background: circle , square , octagon color - any you like


zip contains: python script, converted file of Botswana and this info iO2osm.zip

suntri-star commented 2 months ago

Hello I tried the script. It works perfectly. I will now adapt it to my needs. So I have a solution for my needs. However, I hope that the problem will be incorporated into the product so that it becomes easier. I'm sure I'm not the only one who would be happy about that. I would like to thank you very much for your support. I hope point "Online recording - Buffer for long trips (7 days) #19972" will also be incorporated into the product. I'm on tour at the end of July where I would really like to use it. So thank you again and kind regards from Switzerland.

suntri-star commented 2 months ago

io2osm-namibia.py.tar.gz

I adapted the small script according to my needs. Now I'm very happy with it. Thanks again. Great thing.

yuriiurshuliak commented 2 months ago

The bug has been reproduced. When a custom appearance is set for a group of favorites and new favorites are imported into that group, the new favorites don't adopt the custom appearance.

Currently, we haven't implemented the default appearance for favorites. As a workaround, after importing new favorites, you can change their appearance to the desired one by clicking "Apply to existing". Alternatively, if you prefer to add favorites manually, you can select "Apply only to new favorites," and all manually added favorites will inherit the custom appearance previously assigned.

OsmAnd~ 4.8.0#2476m, released: 2024-06-10

yuriiurshuliak commented 1 week ago
  1. The issue occurs when a custom appearance is set for a specific group of favorites. Any new favorites imported into that group do not adopt the custom appearance previously configured. Instead, they default to standard settings.

Steps to Reproduce:

  1. Additionally, there's a second issue: when you create a new favorite and add it to the group, it adopts the custom appearance in terms of icon and color but does not take on the group’s custom shape. Instead, it defaults to a standard round shape.

Steps to Reproduce:

Summary:

The issues have been confirmed. Imported favorites do not take on the custom appearance set for their group, and newly created favorites in the group do not inherit the group’s custom shape.

OsmAnd~ 4.9.0#2939m, released: 2024-08-09