2

How can I display my current position in the QGIS canvas, similar to the "blue point" in google mapsa?

I need this to navigate to defined points and I do not want to change the program all the time.

2
  • You don't. Make an My Maps account at Google, import your points. Then use My Maps app that works with Google Maps. Then you just click on your points and it will navigate. Qgis aren't geocentric as many mobile apps.
    – CARTOS
    Commented Nov 11, 2015 at 8:13
  • @Salliva2000 thank you and sorry for the late response. I sickened and wasn't inn the office for this time. This means for me, that if I need to edit attributes while I am at this point, I need both: mymaps to navigate and QGIS (on a laptop for instance) to edit (e.g. to mark and comment these points).
    – kevkev
    Commented Nov 24, 2015 at 10:30

1 Answer 1

1

You can try to get the location of your IP address with this python code: import requests import json send_url = 'http://freegeoip.net/json' r = requests.get(send_url) j = json.loads(r.text) lat = j['latitude'] lon = j['longitude'] map_pos = QgsPoint(lon, lat) rect = QgsRectangle(map_pos, map_pos) canvas = qgis.utils.iface.mapCanvas() canvas.setExtent(rect) canvas.refresh()

This will find your estimated location, based on your IP address, and center the map on that location.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.