Tagged: ,

Viewing 15 posts - 61 through 75 (of 228 total)
  • Author
    Posts
  • #31706
    mictie
    Participant

    @juergenl: it seems that the source for this special-link is the ‘node_id’ in your program.
    For input-files directly coming from OSM (.pbf) this matches the OSM-Node-id (not sure about the actual term),
    for input-files from OpenAndroMaps this looks like a running number.

    PS: I saw you updated the program – Great!

    #33379
    Bob gray
    Participant

    Hello.
    Can you tell me how to setup environment for executing poi_converter.py on windows?

    Install required packages: python3.7 git libsqlite3-mod-spatialite
    Install pipenv pip3 install pipenv
    clone this git repository git clone https://github.com/lieblerj/poi_converter.git
    run pipenv update to download and install the necessary dependencies (pyosmium, pyspatialite and tdqm)
    run pipenv shell to activate the virtual environment

    Are these work on windows?
    I found sqlite spatiallite module for windows.
    https://github.com/sqlitebrowser/sqlitebrowser/wiki/SpatiaLite-on-Windows

    but other work, I have no idea. I am very newbie about this
    Your advice would be very helpful.

    #33396
    mictie
    Participant

    Hi,
    am using this program under Windows 10 and it’s working great!
    As you wrote you start it by:”run pipenv update” and “run pipenv shell” followed by “python poiconverter.py …” with the options shown here

    #33398
    Bob gray
    Participant

    Hi, mictie.

    I am working under windows 10 64bit and python 3.7.
    I downloaded mod-spatialite.dll file and copy it into system32 folder.
    and pip install spatialite. But when I command python poiconverter.py, It comes error message.
    and It said osmium is required, but It couldn’t be installed on windows10.
    and pipenv not working.

    Can you tell me the detailed procedure you did?
    Thank you

    #33400
    mictie
    Participant

    Hi Bob gray, to be honest I don’t remember the details how I installed spatialite.

    But I found a note, that I used the answer found here . (“https://stackoverflow.com/questions/33619896/using-spatialite-with-64-bit-pythons-sqlite3-module-on-64-bit-windows-7”)

    Hopefully it helps ….

    • This reply was modified 4 months, 2 weeks ago by mictie.
    • This reply was modified 4 months, 2 weeks ago by mictie.
    • This reply was modified 4 months, 2 weeks ago by mictie.
    #33405
    sadburai
    Participant

    Hi, I also had a lot of trouble to get the script to work on Windows 10 yesterday, but it finally worked. However, I am not sure anymore in which steps I did it. I am also a noob with Python, so probably there is an easier way. It might be helpful if you tell us the exact error message.
    I had these errors:
    1. I couldn’t use ‘python’ or ‘pip’ commands with windows cmd
    2. missing module spatialite
    3. missing module osmium
    4. sqlite module rtree missing

    My workarounds:
    1. => make sure that you check the option to ‘set the directory/path` during insallation (not sure how it was called excatly). I couldn’t get the script to work with Python 3.8 but I am not sure if this is because I made mistakes during the installation, or if it only works with 3.7.
    2. => I downloaded the spatialite file and copied it to system 32. I also used ‘pip install spatialite’ ‘pipenv install spatialite’ and ‘pipenv shell’, then ‘pipenv install spatialite’ Not sure anymore what did the trick, but finally the error message that the module spatialite was missing disappeared
    3.=> Missing module osmium: I tried to use the commands ‘pip install osmium’ and ‘pipenv install osmium’ (<- also after using pipenv shell), but I think that I had error messages during the installation
    Probably I solved this by fixing a problem with the directory of my poi_converter files. I used the cmd commands like that::
    e.g. C:\user\*username\ pip install osmium
    But my poi_converter folder was in C:\user\*usernamel\poi_converter
    After I simply copied all the files from this folder directly into C:\user\Till\ it solved some of my problems and I think that was when installing osmium by using pip or pipenv finally worked.

    4.=> After some googling I found an sqlite3.dll that should have Rtree embedded. So I downloaded this and put it into the system32 folder. However it still said that the Sqlite module Rtree was missing. After I deleted the sqlite3.dll in
    C:\Users\*username\AppData\Local\Programs\Python\Python37\DLLs\ it FINALLY worked.

    To execute the script I used these commands:
    pipenv shell
    python poiconverter.py -if poi -om create bayern.poi bayernloc.db

    Probably there is a much more elegant way to solve these problems, but I am a total beginner as well. I found these workarounds after a lot of googling and Trial&Error and maybe they can help you as well, However it may be better to wait for advice by someone who actually knows what he is doing :P

    • This reply was modified 4 months, 2 weeks ago by sadburai.
    #33408
    Bob gray
    Participant

    Thank you for kind and detail answer, sadburai.

    As your advice,
    1. I installed python 3.7
    2. pip install spatiallite, pipenv install spatialite —> success
    3. pip install osmium, pipenv install osmium —-> failed
    I run that commands at the path of poiconverter, but I met very much lines of error.
    e.g. C:\poiconverter\pip install osmium

    I’v been stuck in step3.

    #33410
    mictie
    Participant

    If you start poiconverter.py with the options necessary (poiconverter.py [-h] [-version] -if {pbf,poi} -om create,append} input_file output_file ) what error messages do you get?
    Please provide details (with line numbers)…
    I cannot find any reference to osmium in the code, so I wonder where this reference is coming from.
    I also don’t remember installing osmium, or seeing osmium related errors

    #33414
    sadburai
    Participant

    Hi again: I checked again if my script works and it does, but only if I use the pipenv shell: The commands I use in CMD:

    pipenv shell
    python poiconverter.py -if poi -om create bayern.poi bayernloc.db

    If you still get errors check out if you have the packages installed: These commands are useful (see my results below):
    pip freeze
    pip list
    pipenv run pip freeze
    Other Useful commands:
    pipenv –help
    pip -help

    pip freeze
    My console shows:
    certifi==…
    pipenv==…
    virtualenv==…
    virtualenv-clone==…

    pip list
    My console shows:
    certifi
    pip
    pipenv
    setuptools
    virtualenv
    virtualenv-clone

    pipenv run pip freeze
    My consoloe shows:
    osmium==2.15.3
    spatialite==0.0.3
    tqdm==4.36.1

    The ‘command pipenv run pip freeze’ does the same as those commands following each other:
    pipenv shell
    pip freeze

    => (does your command path change when you use ‘pipenv shell’? e.g. mine changes from C:\users\… to (“*username-….”) C:\users\….

    So make sure that the packages osmium and spatialite are installed in your pipenv shell and run the python script from the pipenv shell console not from cmd console!

    #33416
    sadburai
    Participant

    Hi again: I think the problem might be that you need to install the required packages in the pipenv shell (virtual environment). If pipenv run pip freeze does not show the installed packages osmium, spatialite and tqdm you might want to try this:

    My folder poi_converter is in C:\users\*username\poi_converter
    1.) run cmd
    2.) cd poi_converter [It might be optional to change the directoryl]
    3.) pipenv shell
    4.) Install the following packages if they do not shows up when using pip freeze
    pip3 install spatialite
    pip3 install osmium
    pip3 install tqdm

    5.) Try to run the script, eg.:
    python poiconverter.py -h
    python poiconverter.py -if poi -om create bayern.poi bayernloc.db

    If any other problem shows up, there might be problems with your DLL files, etc.

    • This reply was modified 4 months, 2 weeks ago by sadburai.
    • This reply was modified 4 months, 2 weeks ago by sadburai.
    #33441
    Bob gray
    Participant

    Thank you again, sadburai,

    I barely setup 3 modules (osmium, spatialite, tqdm) with another computer.(windows7-64bit, python 3.7)
    and command under pipenv shell, I met error sadly.

    I heard that sqlite3.dll in python3 can’t manage spatialite, so I exchanged that with another dll from
    official site (sqlite.org)
    and downloaded spatialite module DLL’s from https://www.gaia-gis.it/gaia-sins/ and copy files to
    windows system32 folder.
    But error message was the same.
    ————————————————————————————————————
    (poiconverter-wS71GxY9) c:\poiconverter>pip freeze
    osmium==2.15.3
    spatialite==0.0.3
    tqdm==4.41.1

    (poiconverter-wS71GxY9) c:\poiconverter>python poiconverter.py -if poi -om creat
    e bayern.poi bayern.db
    Traceback (most recent call last):
    File “poiconverter.py”, line 14, in <module>
    from poiconverter.fileimporter import FileImporter
    File “c:\poiconverter\poiconverter\fileimporter.py”, line 1, in <module>
    import osmium
    File “C:\Users\okok\.virtualenvs\poiconverter-wS71GxY9\lib\site-packages\osmiu
    m\__init__.py”, line 1, in <module>
    from osmium._osmium import *
    ImportError: DLL load failed:

    (poiconverter-wS71GxY9) c:\poiconverter>

    —————————————————————————————————————
    Can you tell me where to get sqlite3.dll compatible with poiconverter.py ?

    Thank you very much for all help.

    #33447
    sadburai
    Participant

    Hi Bob,
    hmm I think I didn’t have this error and I don’t know what’s missing. I can only tell you which files I downloaded from my browser history.

    In this order:
    http://www.gaia-gis.it/gaia-sins/libspatialite-4.3.0a.zip
    https://www.sqlite.org/2019/sqlite-dll-win64-x64-3300100.zip
    http://www.gaia-gis.it/gaia-sins/windows-bin-NEXTGEN-amd64/mod_spatialite-NG-win-amd64.7z
    https://sourceforge.net/projects/cyqlite/files/latest/download => fossil-w64-2.4.zip

    I am not sure anymore exactly how I installed the files, but my guess is:
    – I actually didn’t use the libspatialite-4.3.0a files because afterwards I learned how to use pip to install packages
    – copied all the dll and exe files of mod_spatialite-NG-win-amd64.7z into system32
    – copied the sqlite.dll and fossil.exe files into system32
    – I deleted the sqlite3.dll in C:\Users\*username\AppData\Local\Programs\Python\Python37\DLLs\ [make a backup]

    You can try it on your own risk – again, I am a beginner as well without a clear understanding of the topic ;).
    So, I would maybe install these files in the same steps and after each step I would run the script again, to see if it solved the problem or whether new errors occur. Also it’s always a good idea to restart the computer from time to time.
    Good luck!

    #33531
    Bob gray
    Participant

    Hello, sadburai.
    It worked finally! I tried on windows10(x64) this time with your explanation and DLLs.
    (Maybe some of my windows7 environmet was wrong)
    The whole process went smoothly. It’s all thanks to you.
    But there is a strange thing
    I used bayern.poi file from github site, the number of added POIs was smaller than the number of entries.
    I think some POI’s format of original POI file is different from the others.
    I need study further.
    Thank you again. Have a good day.

    1 user thanked author for this post.
    #33533
    ChristianKChristianK
    Keymaster

    To all of you:

    Please try this poi file – its made with the POI-Writer V2:
    http://download.openandromaps.org/pois/europe/Spain_Portugal.poi.zip
    I have to switch to this writer cause the V1 poi_file specification is likely to be dropped in future

    The old V1 one is included in the zip-file of the map
    http://download.openandromaps.org/mapsV4/europe/Spain_Portugal.zip

    Please take a look at these threads too:
    https://www.openandromaps.org/oam-forums/topic/any-plan-to-move-to-poi-version-2

    https://www.openandromaps.org/oam-forums/topic/mapsforge-poi-version-2

    Best regards
    Christian

    #33547
    mictie
    Participant

    Hallo ChristianK,
    hab das Poi-File convertiert und sehe keine Probleme.

    importer: <class ‘poiconverter.poiimporter.PoiImporter’> Spain_Portugal.poi
    1240489 entries [09:15, 2234.87 entries/s]
    Finished!
    677135 POIs added to database in 558.92 sec!

Viewing 15 posts - 61 through 75 (of 228 total)
  • You must be logged in to reply to this topic.