How to upgrade pgrouting to lastest version (2.6)

If you installed pgrouting from synaptic, probably you have pgrouting 2.4.2.
To upgrade to the last version, download it from github:

tar xzvf pgrouting-2.6.0.tar.gz
cd pgrouting-2.6.0
mkdir build
cd build
cmake ..

-- POSTGRESQL_PG_CONFIG is /usr/bin/pg_config
-- POSTGRESQL_EXECUTABLE is /usr/lib/postgresql/9.6/bin/postgres
-- POSTGRESQL_VERSION_STRING in FindPostgreSQL.cmake is PostgreSQL 9.6.8
-- PostgreSQL not found.
CMake Error at CMakeLists.txt:294 (message):
   Please check your PostgreSQL installation.

To solve it, you need to install postgres developer

sudo apt-get install postgresql-server-dev-9.6
cmake ..

Could not find the following Boost libraries:


-- CGAL not found.
CMake Error at CMakeLists.txt:351 (message):
   Please check your CGAL installation, or set correct path to CGAL_INCLUDE_DIR and CGAL_LIBRARIES.

To solve it, you need to install cgal libraries

Load kml geojson osm shp files in Postgis

In my last post I talk how to convert from kml to GeoJson
Now, I want to load this file in a Spatial and Geographic Objects for PostgreSQL (postgis)
I read in many sites that you can convert from osm 2 postgres, then I will try to convert to osm file with geojsontoosm.

# sudo  npm install -g geojsontoosm

npm ERR! enoent ENOENT: no such file or directory, open '/tmp/npm-15537-43d2f472/unpack-edff7974/package.json'
npm ERR! enoent ENOENT: no such file or directory, open '/tmp/npm-15537-43d2f472/unpack-edff7974/package.json'
npm ERR! enoent This is most likely not a problem with npm itself
npm ERR! enoent and is related to npm not being able to find a file.
npm ERR! enoent 

To install, I used the git files:

# git clone
# cd geojsontoosm

# ./geojsontoosm 
    throw err;

Error: Cannot find module 'jxon'
Error: Cannot find module 'optimist'
Error: Cannot find module 'geojson-stream'
Error: Cannot find mod…

How to fix npm

I tried to install togeojson, but I got the following error:

npm install -g @mapbox/togeojson 

npm ERR! Linux 4.4.0-116-generic
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" "-g" "@mapbox/togeojson"
npm ERR! node v8.0.0-pre
npm ERR! npm  v3.5.3

npm ERR! Cannot find module 'internal/fs'
npm ERR! 
npm ERR! If you need help, you may report this error at:
npm ERR!     <>

npm ERR! Please include the following file with any support request:
npm ERR!     /home/nboettcher/Downloads/togeojson/npm-debug.log

Other common error is:

npm ERR! Cannot find module 'ansi'

To solve them, you must reinstall nodejs and npm with the following sentences:

sudo apt-get remove nodejs npm
curl -sL | sudo -E bash -
sudo apt-get install -y nodejs
sudo apt-get install npm
npm install

Now I have npm 3.5.2, but now it works.
Enjoy it!

How to convert from kml to GeoJson with python3

To do it, you can import ogr from osgeo

from osgeo import ogr

def kml2geojson(kml_file):
    drv = ogr.GetDriverByName('KML')
    kml_ds = drv.Open(kml_file)
    for kml_lyr in kml_ds:
        for feat in kml_lyr:
            print feat.ExportToJson()


But, if you try to run it, maybe you will see the following error:

ImportError: No module named 'osgeo'

This means that you need gdal libraries. If you try to install it with pip3 you will see the following:

pip3 install gdal
cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++
    extensions/gdal_wrap.cpp:3168:22: fatal error: cpl_port.h: No such file or directory
    compilation terminated.
    error: command 'x86_64-linux-gnu-gcc' failed with exit status 1

We search which pakage includes cpl_port.h:

apt-file search cpl_port.h   
libgdal-dev: /usr/include/gdal/cpl_port.h

After install python3-gdal and libgdal-dev you will see that you get the…

How to run pykml in python3

First, you need to install pykml for python3:

sudo pip3 install pykml

Now, if you try to read a kml file you will get the following message:

Python 3.6.3 (default, Oct  3 2017, 21:45:48) 
[GCC 7.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from pykml import parser
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python3.6/dist-packages/pykml/", line 8, in <module>
    import urllib2
ModuleNotFoundError: No module named 'urllib2'

To solve it, you need to fix urllib2 to work well in python3
Edit /usr/local/lib/python3.6/dist-packages/pykml/ and replace:

import urllib2


    # For Python 3.0 and later
    from urllib.request import urlopen
except ImportError:
    # Fall back to Python 2's urllib2
    from urllib2 import urlopen

Now, you need update update the urllib2.urlopen() entries to just u…

Plugin para Tampermonkey para hacer seguimiento de tus productos de Aliexpress en Correos de Chile

Como sabrán, el número de seguimiento que entrega Aliexpress para seguir los productos no es el mismo que requiere Correos de Chile.

Primero hay que destactar que este plugin que desarrollé es sólo compatible con los envíos con los que Correos de Chile tiene convenio (por lo general todos los que dan un plazo de entrega entre 20 y 31 días).

es el plazo de entrega del servicio contratado por el remitente. Si deseas un despacho en menor tiempo, debes solicitar que te envíen vía EMS, PPI Certificado o Encomienda Internacional. Saludos. — correoschile (@correoschile) March 7, 2018

La mayoría de los envíos tienen un plazo superior a los 30 días (entre 30 y 60, incluso hasta 90 dìas), los que corresponden a servicios básicos, los cuales NO poseen seguimiento en Chile, independiente de que Aliexpress indique un número de seguimiento.
respondimos recién un inbox tuyo de FB y los códigos indicados corresponden a un servicio básico, por lo cual no posee seguimiento en Chile y el plazo de entreg…

Issue with USB, Android does it not recognized and explorer freezes

I have this issue with my Xiaomi A1 with Android Oreo
If you try access to your USB OTG and when you plug it and click OK on this pop-up window:

Maybe your app will freeze and you couldn't access to your USB, like that

I tried with es explorer non-pro version and it got this info (the app freeze also):

To solve it, just choose Cancel instead of OK when you insert your USB. Wait until the USB starts to blink (around 25 seconds) and try to access to it again.
Enjoy it!