navit-gps / navit

The open source (GPL v2) turn-by-turn navigation software for many OS
http://www.navit-project.org
Other
559 stars 175 forks source link

html Error in navit.xml file when launching for first time #1228

Open sircsaba opened 1 year ago

sircsaba commented 1 year ago

I'm using a RPI 4 and a serial GPS which is working perfectly and is running when I install and execute Navit for the first time. I made the modifications for my own map and everything else as indicated and I'm getting the following error message : Error parsing config file 'navit.xml': Unknown element 'html' at line 9, char 1 at line 404, char 51

I tried reinstalling with su privileges and still get the same error message.

Any ideas ?

jkoan commented 1 year ago

Please upload the navit.xml so we can take a look. You can use https://gist.github.com/ to upload the file

sircsaba commented 1 year ago

Sorry but I redid the system with Android and using other software ... I will try and find a copy that I made ...

Davem734 commented 1 year ago

Same problem here. Using Ubuntu 22.04 on laptop installed as follows:

sudo apt -y install navit                   # Navit is a car navigation system with routing engine.
sudo apt -y install navit-gui-gtk           # Car navigation system with routing engine - GTK+ GUI plugin
cd /usr/share/navit/                                                                                # Download files that are missing in the debian/ubuntu distro
sudo wget https://github.com/navit-gps/navit/blob/trunk/navit/navit_layout_bike_shipped.xml         #  https://github.com/navit-gps/navit/issues
sudo wget https://github.com/navit-gps/navit/blob/trunk/navit/navit_layout_car_android_shipped.xml  # .
sudo wget https://github.com/navit-gps/navit/blob/trunk/navit/navit_layout_car_dark_shipped.xml     # .
sudo wget https://github.com/navit-gps/navit/blob/trunk/navit/navit_layout_car_shipped.xml          # .
sudo wget https://github.com/navit-gps/navit/blob/trunk/navit/navit_layout_car_simple_shipped.xml   # .
sudo wget https://github.com/navit-gps/navit/blob/trunk/navit/navit_layout_th_shipped.xml           # .
cd ~                                                                                                # Download files that are missing in the debian/ubuntu distro
sudo apt -y install maptool                 # Converts OpenStreetMap maps to Navit
# navit config: ~/.navit/navit.xml          # .
mkdir -p /RAID/$USER/Apps/navit/maps        # .
mv ~/.navit ~/.navit_$DATE                  # .
ln -s /RAID/$USER/Apps/navit ~/.navit       # .
cp /etc/navit/navit.xml ~/.navit/navit.xml  # (https://navit.readthedocs.io/en/latest/configuration/index.html)
sed -i 's|<gui type="internal" enabled="yes"|<gui type="internal" enabled="no"|g' ~/.navit/navit.xml                # Use GTK gui
sed -i 's|<gui type="gtk" enabled="no"|<gui type="gtk" enabled="yes"|g' ~/.navit/navit.xml                          # Use GTK gui
sed -i '/sample map/{n;s/enabled="yes"/enabled="no"/}' ~/.navit/navit.xml                                           # search for 'sample map', on the next line substitute 'enabled="yes"' with 'enabled="no"'
sed -i '/OpenStreetMap/{n;s/enabled="no"/enabled="yes"/}' ~/.navit/navit.xml                                        # search for 'OpenStreetMap', on the next line substitute 'enabled="no"' with 'enabled="yes"'
sed -i 's|<map type="garmin" enabled="yes"|<map type="garmin" enabled="no"|g' ~/.navit/navit.xml                    # Disable garmin map type
sed -i 's|data="/media/mmc2/MapsNavit/osm_europe.bin"|data="~/.navit/maps/north-america.bin"|g' ~/.navit/navit.xml  # Point to OSM maps folder 
sed -i 's|center="11.5666 48.1333"|center="-83.0 42.0"|g' ~/.navit/navit.xml                                        # Center on Home 
sed -i 's|<log enabled="no" type="gpx"|<log enabled="yes" type="gpx"|g' ~/.navit/navit.xml                          # Save GPX file logs of trips
# source="gpsd://localhost"  source="gpsd_dbus:" 
#
# Download OSM Map North America 25GB (needs 50GB of free space and 21 hours to convert)
cd /RAID/$USER/Apps/navit/maps                                  # Download OSM Map North America
rm *.bz2                                                        #   OpenStreetMap ReadOnly (XAPI) to get the map data of a specific bounding box using four GPS corners:
rm *.bin                                                        #     - For example: wget -O selected-map.osm “http://xapi.openstreetmap.org/api/0.6/map?bbox=11.4,48.7,11.6,48.9”
wget http://download.geofabrik.de/north-america-latest.osm.bz2  #   or: 
bzcat north-america-latest.osm.bz2 | maptool north-america.bin  #     - Maps by region, updated daily: http://download.geofabrik.de/ 
rm *.bz2                                                        #   Convert OSM map file to bin map file using maptool
cd ~/                                                           # Download OSM Map North America

Error is:

(navit:45206): GLib-WARNING **: 14:05:36.438: GError set over the top of a previous GError or uninitialized memory.
This indicates a bug in someone's code. You must ensure an error is NULL before it's set.
The overwriting error message was: Unknown element 'html'

(navit:45206): GLib-WARNING **: 14:05:36.438: GError set over the top of a previous GError or uninitialized memory.
This indicates a bug in someone's code. You must ensure an error is NULL before it's set.
The overwriting error message was: Unknown element 'html'
error:navit:main_real:Error parsing config file '/home/davem/.navit/navit.xml': Unknown element 'html' at line 9, char 1
 at line 9, char 1
 at line 9, char 1
 at line 9, char 1
 at line 9, char 1
 at line 9, char 1
 at line 459, char 58

Attached is navit.xml

navit.zip

Davem734 commented 1 year ago

It looks like the URL's I am using to download the missing .XML files are downloading an HTML document and not the .XML file. The correct path to the .XML files is:

https://raw.githubusercontent.com/navit-gps/navit/trunk/navit/

Unfortunately, I am still getting parsing errors:

$ navit
error:navit:traffic_new:wrong type 'null'
error:navit:xinclude:Unable to include '/usr/share/navit/maps/*.xml'
error:navit:xinclude:Unable to include '/home/davem/.navit/navit_layout_*.xml'
error:navit:attr_new_from_text:Unknown item type 'embankment' ignored.

(navit:327691): GLib-WARNING **: 09:48:53.089: GError set over the top of a previous GError or uninitialized memory.
This indicates a bug in someone's code. You must ensure an error is NULL before it's set.
The overwriting error message was: Element 'layout' within unexpected context '\u000cc\xefd\u0005'. Expected 'navit'

(navit:327691): GLib-WARNING **: 09:48:53.089: GError set over the top of a previous GError or uninitialized memory.
This indicates a bug in someone's code. You must ensure an error is NULL before it's set.
The overwriting error message was: Element 'layout' within unexpected context '22'. Expected 'navit'
error:navit:main_real:Error parsing config file '/home/davem/.navit/navit.xml': Unknown element 'spikes' at line 1369, char 52
 at line 3, char 1
 at line 3, char 1
 at line 459, char 58
Davem734 commented 1 year ago

Looks like there is a bug parsing the navit_layout_car_shipped.xml file. If I remove Item types: "cliff,embankment" from the file then it works. Here is the script that I used to install Navit on Ubuntu 22.04. Hopefully this will be of use to someone having problems installing Navit:

#!/bin/bash
#
DATE=$(date +%y%m%d)
#
# Navigation
mkdir -p /RAID/$USER/Apps/navit/maps                 # Navit is a car navigation system with routing engine.
mv ~/.navit ~/.navit_$DATE                           # .
ln -s /RAID/$USER/Apps/navit ~/.navit                # .
sudo apt -y install navit                            # .
sudo apt -y install navit-gui-gtk                    # Car navigation system with routing engine - GTK+ GUI plugin
sudo apt -y install navit-graphics-gtk-drawing-area  # Car navigation system graphic gtk-drawing-area plugin to use with GTK+ aware GUI plugins
cd /usr/share/navit/                                                                                          # Download files that are missing in the debian/ubuntu distro
sudo wget https://raw.githubusercontent.com/navit-gps/navit/trunk/navit/navit_layout_bike_shipped.xml         #  https://github.com/navit-gps/navit/issues/1220, 
sudo wget https://raw.githubusercontent.com/navit-gps/navit/trunk/navit/navit_layout_car_android_shipped.xml  # .
sudo wget https://raw.githubusercontent.com/navit-gps/navit/trunk/navit/navit_layout_car_dark_shipped.xml     # .
sudo wget https://raw.githubusercontent.com/navit-gps/navit/trunk/navit/navit_layout_car_generatedarkxml.sh   # .
sudo wget https://raw.githubusercontent.com/navit-gps/navit/trunk/navit/navit_layout_car_shipped.xml          # .
sudo wget https://raw.githubusercontent.com/navit-gps/navit/trunk/navit/navit_layout_car_simple_shipped.xml   # .
sudo wget https://raw.githubusercontent.com/navit-gps/navit/trunk/navit/navit_layout_th_shipped.xml           # .
sudo sed -i -e '/item_types="cliff,embankment"/,+7d' /usr/share/navit/navit_layout_car_shipped.xml            # Remove Item types: "cliff,embankment" that causes parsing errors, https://github.com/navit-gps/navit/issues/1228
cd ~                                                                                                          # Downloaded files that are missing in the debian/ubuntu distro
sudo apt -y install maptool                          # Converts OpenStreetMap maps to Navit bin files
cp /etc/navit/navit.xml ~/.navit/navit.xml                                                                          # (https://navit.readthedocs.io/en/latest/configuration/index.html), navit config: ~/.navit/navit.xml 
sed -i 's|<gui type="internal" enabled="yes"|<gui type="internal" enabled="no"|g' ~/.navit/navit.xml                # Use GTK gui
sed -i 's|<gui type="gtk" enabled="no"|<gui type="gtk" enabled="yes"|g' ~/.navit/navit.xml                          # Use GTK gui
sed -i '/sample map/{n;s/enabled="yes"/enabled="no"/}' ~/.navit/navit.xml                                           # search for 'sample map', on the next line substitute 'enabled="yes"' with 'enabled="no"'
sed -i '/OpenStreetMap/{n;s/enabled="no"/enabled="yes"/}' ~/.navit/navit.xml                                        # search for 'OpenStreetMap', on the next line substitute 'enabled="no"' with 'enabled="yes"'
sed -i 's|<map type="garmin" enabled="yes"|<map type="garmin" enabled="no"|g' ~/.navit/navit.xml                    # Disable garmin map type
sed -i 's|data="/media/mmc2/MapsNavit/osm_europe.bin"|data="~/.navit/maps/north-america.bin"|g' ~/.navit/navit.xml  # Point to OSM maps folder 
sed -i 's|center="11.5666 48.1333"|center="-83.7457 42.2229"|g' ~/.navit/navit.xml                                  # Center on Home KARB: 42.2229276,-83.7457088
sed -i 's|<log enabled="no" type="gpx"|<log enabled="yes" type="gpx"|g' ~/.navit/navit.xml                          # Save GPX file logs of trips
cd ~/.navit/maps                                                # Download OSM Map North America 25GB (needs 50GB of free space and 21 hours to convert)
rm *.bz2                                                        #   OpenStreetMap ReadOnly (XAPI) to get the map data of a specific bounding box using four GPS corners:
rm *.bin                                                        #     - For example: wget -O selected-map.osm “http://xapi.openstreetmap.org/api/0.6/map?bbox=11.4,48.7,11.6,48.9”
wget http://download.geofabrik.de/north-america-latest.osm.bz2  #   or: 
bzcat north-america-latest.osm.bz2 | maptool north-america.bin  #     - Maps by region, updated daily: http://download.geofabrik.de/ 
rm *.bz2                                                        #   Convert OSM map file to bin map file using maptool
cd ~/                                                           # Downloaded OSM Map North America
#

If there is a better place to post this, please let me know. And big thanks to everyone who put so much work into developing Navit!

robzane commented 1 year ago

beautiful job thank You