This object is in archive! 

Can I use the API to take a map screenshot?

Carlos Vela shared this question 6 years ago
Answered

From the Locus API I know I can use the method "ActionTools.getMapPreview" to get a screen-shot by a given Point.


What about if I just want to get a screen-shot from what is currently being shown in Locus Map?

Replies (3)

photo
1

Good day Carlos,

If you wants to get "screenshot" of what is currently visible on the screen, you needs to specify all necessary parameters in request on "mapPreview".


Key is here obtain of "UpdateContainer" class with current app state. This may be done by using Periodic updates: https://github.com/asamm/locus-api/wiki/Periodic-updates


With known update container, you may have all parameters to request required map screenshot in correct zoom level and map scale.


If there will be need for an more simply "screenshot" method or any issue with this system, let me know and we may discuss it. Keep also in mind, that I just updated wiki page about periodic updates because it was little bit outdated and also because of this, sample application does not work right now ... update (prepared) is needed. Thanks for understanding.

photo
1

Hello Menion


Thanks for your reply.


I did implement the Periodic-updates functionality in my code. But then I notice, I don't want this to be "periodic". I just want this information one time. I saw in the API sample that you can call from the Locus Map the Add-On application and receive the "MapCenter" Location object. I'm just missing the zoom level data.


Is there a way to get this info?


Regards

Carlos Vela

photo
1

Hello Carlos,

I'm worried that at least once received UpdateContainer class will be needed here. It contains all necessary information for your task , in this case by updateContainer.getMapZoomLevel().


Please keep in mind, that I'm doing and improving this API mainly based on my personal or other developers needs. Because taking screnshots was currently used only for a small watches, it was never needed to take and send screenshot of whole screen. Because of this, Bitmap object is send directly over intent, which probably won't work for bigger screens ( content of intent is limited to 1 MB! ), so this will needs and a) improvements and sending big screenshots over file, or b) disabling this feature for bigger screenshots then certain defined.

Let me know, in case of any troubles, what you will need to achieve and we should talk about possibilities.

Menion

photo
1

Understood.


I was just trying to take screenshots of what is being shown in Locus Map. I saw in the Locus Map functions that you can share your screen. So, I was wondering if I could automate that functionality with just one tap / click and in the process add some labels to the generated image.


Anyway, thanks for your support,

photo
1

Sure, you are welcome.

Replies have been locked on this page!