Groups keyboard shortcuts have been updated
Dismiss
See shortcuts

MAP COMPONENT ISSUE

78 views
Skip to first unread message

michael judkovsky

unread,
May 5, 2019, 3:19:18 AM5/5/19
to MIT App Inventor Forum
HELLO FRIENDS
WHEN TRYING TO DRAG OR ZOOM IN/OUT THE MAP, THE APP FREEZE AND I  GET THE MASSAGE AS SEEN ON THE ATTACHED FILE.
ANY HELP WILL BE HIGHLY APPRECIATED!!
THANKS ALOT
MIKE
Screenshot_20190505-030159.jpg

michael judkovsky

unread,
May 5, 2019, 3:44:22 AM5/5/19
to MIT App Inventor Forum
Tablet: galaxy tab a(2016)
OS: Android 8.1.0

michael judkovsky

unread,
May 5, 2019, 4:35:20 AM5/5/19
to MIT App Inventor Forum
HERE IS A CLUE THAT I FOUND BY TRIAL AND ERROR. THE PROBLEM EXIST WHEN "ShowZoom" AND "EnableZoom" ARE BOTH TRUE!!! WHEN "ShowZoom" IS TRUE AND "EnableZoom" IS FALSE THE PROBLEM DISAPPEAR. STRANGE...

TimAI2

unread,
May 5, 2019, 7:47:45 AM5/5/19
to MIT App Inventor Forum
There is no need to "SHOUT" (type in uppercase)
Please use sentence case for posting in subject and content

michael judkovsky

unread,
May 5, 2019, 7:51:16 AM5/5/19
to MIT App Inventor Forum
Sorrý. Wont happen again

SteveJG

unread,
May 5, 2019, 8:23:58 AM5/5/19
to mitappinv...@googlegroups.com
I have several apps that are set to ShowZoom and SetZoom simultaneously.  None of them exhibit the RunTime error you report Mike.  I have an A10 Samsung 8.1

Does this happen when you have both set from the Designer or when you use Blocks to set them?   Or does it happen when you toggle the state of either?  Does this happen when you build your app and install or when you use Companion or both?  Asked another way, what were you doing when the runtime error appeared?  Clicking a button, zooming using the tool's +  /  -  buttons on the map, pinching/expanding the displayed map?

Post your Project blocks here in the Forum or an aia so someone can test.  Or post a small example aia demonstrating the issue.

Based on the image posted, it is probable you have an issue with a LineString, Polygon or FeatureCollection or your Green Marker rendering properly when both Properties are set.  We don't really know because 
we cannot test your app code.  This problem does not occur on any of my apps so I expect it happens because of something in your Blocks

Regards,
Steve

michael judkovsky

unread,
May 5, 2019, 9:31:43 AM5/5/19
to MIT App Inventor Forum
It happen when are both set at Designer level. I do not change/toggle them in the blocks.
My project contains like 20 blocks, 15 procedures . How I post them in the forum?
It happens after app installation using compagnion 2.51 with QR code


SteveJG

unread,
May 5, 2019, 9:44:31 AM5/5/19
to MIT App Inventor Forum
1) you should be using Companion 2.51a or 2.51au Mike
2)  Right click a white area of your Blocks screen, select   Download blocks as an image   .   Use the blue image icon to the left of Link above and drag the downloaded image into the screen taht appears.
3  or create your aia and then with the paperclip icon above Attach your aia file by dragging on to the screen..

4) are you using a LineString, Polygon or a FeatureCollection?

michael judkovsky

unread,
May 5, 2019, 10:11:51 AM5/5/19
to MIT App Inventor Forum
I use two linestrings. Not use poligon or featurecollection.
Actually I use 2.51a.
Do I need to expand all the blocks and arrange them before making the image?

SteveJG

unread,
May 5, 2019, 11:39:13 AM5/5/19
to mitappinv...@googlegroups.com
Yes, expand the Blocks to provide an image.  

The issue is certainly related  to your LineString.  Either a bug in the component or something wrong with how you defined it or how large the file may be.  How do you define the LineString?  The issue also could be an 
issue with your WIFI link to OpenStreetMap tile server. 

Chris Ward

unread,
May 5, 2019, 12:07:12 PM5/5/19
to MIT App Inventor Forum
Hello Michael

Step-by-step guide to making a Blocks Image and posting to the forum:

michael judkovsky

unread,
May 5, 2019, 12:14:46 PM5/5/19
to MIT App Inventor Forum
I did it all. Sorry, I do not find the icon to attach the image file.

SteveJG

unread,
May 5, 2019, 12:20:05 PM5/5/19
to MIT App Inventor Forum

attachImage.PNG

then drag the image into the pop up that appears Mike.

michael judkovsky

unread,
May 6, 2019, 1:11:09 AM5/6/19
to MIT App Inventor Forum

blocks (2).png

I hope I made the image and attachment properly.

As I mentioned the APP is quite big and I think it is may not be easy  to understand from it the cause of  being stuck when both "EnableZoom" and "ShowZoom" are logical "True" . Thanks anyway

Mike

SteveJG

unread,
May 6, 2019, 9:02:48 AM5/6/19
to MIT App Inventor Forum
I see most of the logic Mike, unfortunately I was not able to determine with certainty where you construct the LineString.  You have been busy.

1) You use the AdvancedLocationSensor extension (so you can get a bearing I imagine) .  You use it in conjunction with the MIT Map component .  The ALS does not interface well with the Map component. See https://groups.google.com/forum/#!msg/mitappinventortest/k7aCXAxH28M/HDJ3KhyUAQAJ 

2) I believe you see the errors  because you calculate your LineString on the fly using complex formula .  That calculation probably cannot keep up with rapid Map changes using either the Map's + / -  buttons or by expanding or pinching the Map itself with touches.  You elicit the Runtime error regarding XML (the LineString is stored internally as an XML file. 

How can you fix this? 

1)Save the LineString calculation to a global variable periodically.  Use the pre-calculated LineString instead of a continuously changing LineString, I expect you would not get the error Mike.  I guess it is important to continuously update?  

2) A factor might be how often you update both your location AND the LineString.   How often do you attempt a satellite fix (e.g. what is the LocationSensor..TimeInterval)?.   You may be checking too frequently.and that exacerbates the problem if the LocationSensor.ChangedLocation event triggers calculation of the LineString coordinates.

3) You appear to calculate a lot of things using your own Blocks.  Still, you use the MIT Map component that has similar routines built-in that execute faster.  Using the built-in routines would make your determination of the LineString coordinates faster; that might help.

4) Niclas Rins AdvancedLocationSensor is a great tool; in this case the standard LocationSensor might be more appropriate as a guess.  You place a lot of calculations into the LocationChanged event.  Doing this is sometimes OK but if your calculations are extensive, this programming practice can and will cause unexpected issues because App Inventor processes asynchronously.

5) This happens when "when both "EnableZoom" and "ShowZoom" are logical "True" ... so do not have them set that way all the time   or try this using only EnableZoom (so you use pinches and expansion to control the screen map tiles).  A magic cure might be to add a  when Map1.BoundsChanged event to inhibit the LineString from changing during a zoom.

6) Another magic cure might be to add an empty Screen1.ErrorOccurred block.  This technique might suppress the error message and allow you app to not freeze.   This is not the best programming practice, but it might be a practical solution.  Sometimes providing a block will hide the error message, then allow the app to continue without stalling.  More often it won't help, but you could try it.


7) When the LineString is NOT continually changing (as in my apps) the error you see does not happen.  Either a bug in the component or something wrong with how you defined it .  You continuously update it and I expect occasionally the  map tile size is changed simultaneously with changing the coordinates used to display the LineString and the compiled app gets confused and elicits an error.  After looking at your Blocks Mike, I believe this behavior is not really a bug but how you continuously update the course LineString.

8)  I doubt this is a component bug.   I expect these Properties behave as expected along with the OpenStreetMap api that MIT uses.  It is probable MIT cannot change their behavior which, based on my own experience using a static LineScreen working properly while zooming, cannot change the behavior.   I expect you have to live with this and adapt your app.


 I hope these comments are useful. Interesting app, I used to race a 470.  Good luck with it.

Regards,
Steve

michael judkovsky

unread,
May 6, 2019, 9:36:00 AM5/6/19
to MIT App Inventor Forum
 Thanks for the advises Steve
I will try to implement what is within my capabilities. However I must mention that the LineString calculations (Which BTW shows the sailing direction as in chart-plotters) is done only when the ALS is enabled, while the freezing problem appears also when the ALS is disabled . 
 I tried to use the ShowUser but it seems that it is not interfacing well with the ALS. And the ALS gives important information specially the Bearing(which is not provided by the LS)
Thanks again
Regards
MIke

SteveJG

unread,
May 6, 2019, 10:33:44 AM5/6/19
to MIT App Inventor Forum
You use  LineString  LineString_Route perhaps to display an planned course.
You useLineString_Sail_Direction to display your current plot within the LocationChanged event.


navigate.PNG

Best guess is the value in the LineString_Sail_Direction.Points is not always properly forming.  One reason is all that stuff you calculate ahead of it.  You might move the LineString to the top of the execution order and see what happens.   You can also do a DoIt on the actual values and see what is happening with the values (you could also post them to a temporary label within your app as a check)

When you disable ALS, your last used LineString_Sail_Direction.Points are the current values...if they are corrupted, they will probably elicit the error as you attempt to zoom


Bearing can be calculated using this Procedure I developed: 

navigateBearing.PNG

The ALS is not needed.  I think there is also a javascript that calculates bearing but for the moment I cannot locate it. It would calculate faster.


Also, rather than calculate the  LineString_Sail_Direction.Points you might do this from a string 

NavigatePoints.PNG

You will need to do a LOT of experimenting.  Good luck.


-- Steve


michael judkovsky

unread,
May 6, 2019, 4:08:08 PM5/6/19
to MIT App Inventor Forum
Hi Steve
Just to close the case and before I am going to labor...
1. The question mark you put next to "Track Panning" procedure: This procedure centralizes the Map and the track-marker when it reaches the boundries during track mode.
2. I tested the APP when driving my car traveling at 60 MPH. In this case the ALS is triggered very fast and yet every thing was functioning excelent. The Tracking-marker, the bearing-LineString,the North-up/Bearing-up toggle, The speed and bearing text box display and so on . I really enjoed it...
3. So yes I have a lot of experiments to do...
Thanks again
Mike
Reply all
Reply to author
Forward
0 new messages