2017년 8월 4일 금요일

Need help with compass - I want to try App-inventor App.


I want to create an compass app, that should point to specific gps-coordinates on the map. I have already gone through the earlier post of and followed this URL , but this is not working properly.

https://puravidaapps.com/snippets.php#2bearing

bearing.aia




21.4167° N, 39.8167° E

Aim in India-south, When I used the taifun example with the above coordinates it is showing me east direction, not west. So aim assuming this is not working, I need your expert guidance to resolve the issue.

Thank you for your help in advance.

--
Here is a different example..it shows how to use a map or grid bearing; this might be what you want to do  

if not, Taifun will probably respond to his tutorial ..I understand is is unavailable through the middle of October but perhaps he will see your post.

--
I have followed the steps and found Bearing Blocks missing in the AI2 Static Maps, Can you take a into it please ? 

--
Sorry about the missing set of blocks Abdul.  The bearing algorithm is now posted in the Rest of the Blocks section (page 8)  of the tutorial   MapsAI2-104 updated 9/30/2015.

Did you find it?    Hope you find the tutorial useful.

--
Thank you Steve, Your Tutorial is very very helpful. 
  
I have added the coordinates and NOW IT Shows correct Bearing direction in the MAP View, But i need few more assistance to make it Usable.

1.  I am unable to see the Line Between Source and Destination Coordinates.
2.  I want to add Orientation Sensor so that it shows me Direction in Real Time Compass.

Please find the below screen snap.
Thank you for you help in advance.

--
Glad the example is mostly working for you.

1)  You are using the Source2 option for displaying the map.  That option is currently providing a zoom value of 3.  Did you code the entire app and initially use the default coordinates recommended in the tutorial?  I suspect you do not see the red line because either because you did not code the F destination (I do not see the green F pin on the map) or you need to change the map zoom to perhaps 2 or 1 (because there are too many Google map tiles between the F and S locations).    I cannot see your blocks, so I do not know.

If all the blocks are correct, you would see the the red 'connecting' line between your GPS location and Boston Adul.  You need to build the app as shownt first to ensure you have correctly coded all the blocks, then modify it to suit your needs.  To get the proper display using your information, you might have to select Source1   and you should see a map with both  your location lat1/lon1  and Boston.   You changed the Lat2/Lon2 location, that is ok, but did you ensure the default locations worked first before modifying the app?  Please recheck your blocks.  Did you initially code everything in the example as shown before modifying?

2) This example does not use the Orientation Sensor.  To do use the Orientation Sensor follow the example provided by Taifun https://puravidaapps.com/snippets.php#2bearing


and either add the code to the example app or code his example by itself.   You have to do that. The Static Map tutorial does not show how to do that intentionally.  To use Taifun's code, you would need to use the Lat2/Lon2 coordinates in his blocks and use his compass rose image to work with the orientation sensor.

--
Thank you Steve, I have rechecked the blocks and found few issues in Static Map URL construction, i fixed it. Now i am able to see the "S" and "F" Markers on the Map and able see the Line Between both locations after removing the Text Box(as highlighted below). Please review and let me know if i have implemented the this correct ? 

However i need to figure out and make this Bearing Integration with Azmitul or Orientation sensors. 

--
To make an app that will point toward Mecca, use the example shown here 
An enhancement to the compass app to provide additionally the direction to a waypoint
in the list of Taifun's snippets  http://puravidaapps.com/snippets.php     What you need is not a compass but something to point in the direction you want, which is this example.

How you might integrate Taifun's example into the tutorial you are working on I do not know.  As a first try, you might just download the aia file from Taifun's web page and load it, then substitute the required coordinates in the target latitude and longitude.   See the circled download aia area?

Substitute and try out the app.  

Regarding fixes... it appears you found the main problem.  Good detective work. Several blocks are shown disabled in the tutorial images(the gray color); those blocks are there for information purposes.  Do not code them or if you do, make sure the blocks are disabled.  Looking at your posted image, there is another of those blocks ...the one with http://www.colorado .....   either eliminate it or disable the block.

--
Taifun example wasn't working as indicated in my earlier post. Your example has visual map + waypoint + more and it is really helpful.

--
Taifun needs to trouble shoot his app.     Did you try to test his app when you were indoors?    Be aware, the orientation sensor does point to magnetic North ... it also points to sources of magnetism..like your computer monitor  or a running electric motor  and is influenced by lots of metal.   Did you run his app away from you computer?     You might get a better 
result.   good luck.

Glad the tutorial is useful but sad it does not solve your problem.  

--
I have tried outdoor as well. it is not giving proper results. Do you know any other procedure to achieve the result. Please let me know ?

--
Attached is a version of Taifun's waypoint code.   I do not know why you could not successfully use Taifun's example.  This  version of the app works correctly to find    مكة المكرمة  from my location; it provides a correct bearing and the orange arrow points there.  You need to wait a few seconds for the LocationSensor to stabilize after the app is initialized.   Make sure you have your GPS turned on in your Android's Settings menu.

I suspect the example did not work perhaps because you did not have a LocationSensor1.LocationChanged block.  You would get an erroneous result if the LocationSensor.Latitude and Longitude both reported 0 . If the values do not change, the app will not work because the code is based on local GPS coordinates   I made  other changes for various reasons.

Try the attached aia.  Let me know if the modified app works at your location.   Please walk away from you computer screen and other magnetic objects when you test.

Does this work?








--
Thank you Steve, The modified version of code is working excellent. 
It was a great experience working with you. Thank you again. :-) 

--

search results for Google spreadsheet select statement


your URL is not correct, see again here https://puravidaapps.com/spreadsheet. php#select. a correct URL looks like this. Taifun ...
first do a SELECT statement using the Google Visualisation API https:// puravidaapps.com/spreadsheet.php#select to select your row you like to modify ...
Hi Taifun. I did read that google visualization API and why I asked about the capitalization. I also saw that you could put the select statement directly ...
normally you would use the fusiontable component and a SELECT statement. see the Pizza Party tutorial Pizza Party with Fusion Tables for App ...
according to the Google Visualisation API the correct SQL statement should be. SELECT B. see also https://puravidaapps.com/spreadsheet.php# ...
There are no formulas available in Google fusiontables, probably you are looking at a Google Spreadsheet? ... To get the number of orders from Martin, you have to send a SELECT statement to the table like this. SELECT ...
Also, are your only options to use a php script or Google spreadsheet? (I don't know what ... you could download all data with one SELECT statement.
The example spreadsheet had 3 columns: name, email and message text. ... The script will be triggered and executes the following statement (pseudo code): ... In column "Run" select the function "action" from the dropdown list.
you have to adjust the example to your needs and use it together with your link to your spreadsheet. then you can define a select statement to select some information you like. The Google Visualisation API works for public ...
the sql statement looks fine. you also can try a select * where B like 'Bell%'. or as test try a select * where B = 'Bell Tower'. or as test try a select *.
see also https://puravidaapps.com/spreadsheet.php#select. Do you have an idea of what is to be in this SQL statement? try a. SELECT A GROUP BY ...

Someone could give me an example in App Inventor 2 to use the web component and insert spreadsheet tables using the URL and see them in my application.


Please SEARCH in this forum before posting your question.   There's a good chance your question has already been asked.

If you are asking for technical help, you must provide the following information:
- Are you using MIT App Inventor Classic, MIT App Inventor 2, or something else (what?)
- What OS are you using? (e.g, MacOS 1.8, Windows 8, ...)
- What browser are you using (e.g, Chrome version 30, Firefox 24, IE 8, ...)
Also provide as much information as you can, such as screenshots and instructions that will let others duplicate the issue.

--
normally you would use the fusiontable component and a SELECT statement 
and the documentation how to create a SELECT statment https://developers.google.com/fusiontables/docs/v1/sql-reference#Select

alternatively you also can use the web component to read data, see screenshot

to display the data in your app, you could take a look at this solution 

--
I have tried your screenshot above to retrieve information from a stored fusion table automatically but I am clearly doing something wrong.  
I have looked at the Pizza tables app and that has been helpful, however I need on this particular screen of the app for the information from the fusion table to be displayed automatically to the user.

--
you forgot the space after FROM

--
Thanks for the 'space' however I now receive notice that it cannot get a response from the table.  
The secure area of the app where information is uploaded to the fusion table still works fine,
sorry for the hassle.


--
your table must be accessible at least by everyone with link
see also the Pizza Party tutorial http://appinventor.mit.edu/explore/ai2/pizzaparty.html

Determining your Fusion Table URL and Table ID
In the blocks editor, you will set the WebViewer component's HomeURL property to point to the URL of your table. To find your Fusion Table's URL:

1. In your browser, navigate to the new Fusion Table you just created.
2. Go to the menu and select Tools > Publish.
3. You'll see a notice saying: "This table is private and will not be visible". Click the blue link that says "Change Visibility".
4. In the list of "Who Has Access", click the blue "Change..." link next to "Private - Only people listed below..."
5. Choose"Public on the Web" or "Anyone with the link". Either of these settings will work for this tutorial. In the future, you should decide this setting based on the sensitivity of your data.
6. Click the green Save button, then the blue Done button.
7. Back on the Fusion Table page, go to the menu bar and select Tools > Publish. Select the URL from the top text box (labeled "Send in an email or IM"), copy the URL and return to App Inventor. 


You will paste the URL into the definition block for the TABLE_URL (see below).

1. You can find the Table ID by browsing to your table, then selecting File>About this table in the menu.

--
Thanks Taifun for your help and patience

--
in response to your suggestion ...to display the data in your app, you could take a look at this solution App Inventor and dynamic table layout with any number of rows and columns
I have spent the evening without success trying yo convert your tutorial to app Inventor 2.  is there any chance you could create the dynamic table using app 2
--
thanks for app 2 solution earlier on today, unfortunately it seems to be confusing me more than ever.  I have used a web component to retrieve the information (you gave me earlier) I have tried in vain to alter the code to no avail.
Please can you have a look and tell me how to adapt the dynamic table code you provided to take from a web component
--
see screenshot and attached modified table example
btw. are you aware, that you can also display the fusion table directly in the webviewer using the table url? see also the Pizza Party tutorial...
i am aware of direct view, i have that on another part of the app, this part the visitors can only see the table i dont want them to be able to edit it.
I will try your solution now, thanks again

--
you are probably getting very bored of me now.... 2 further queries
1. if I am getting my data from a fusion table (xlsx) how can I make that an html file?

2. is the URL of where I am downloading the table from the table URL variable used previously or is that a new url that I need to locate as I'm getting a google error that "400 that's an error.  your client has isseued a malformed or illegal request"
Thanks for your continued patience
--
1. if I am getting my data from a fusion table (xlsx) how can I make that an html file?
xlsx looks like an excel sheet?
the example above gets the data from a fusion table with the web component and displays it with the webviewer using the html file, which previously was downloaded to your device
2. is the URL of where I am downloading the table from the table URL variable used previously or is that a new url
you have to define the table id and API key and use these instead of the table URL, see also the Pizza Party tutorial 
--
I have used your file that you sent me, I have changed the API Key, Table id and URL.  but the result doesn't display in the table as per your example.


--
strUrl is the url, the html file to display the table is downloaded from, this is not your fusiontable url!
strFIlename is the htnl filename to display a table, this is not your table name in the example you only have to change the marked variables, see screenshot

--
According to the previous I did the steps that you had mentioned to me but I could not leave with the mentioned exercise

Here I attach the block and the error that I get when I run the emulator:

Exercise taken from youtube in app inventor clasic

Thanks for all your contributions, I will wait with your help ... !!



--
well, the error message says it all...
you only have two columns... and if you try to get an element from column 3 you get that error

--

There is a problem parsing the package


I have been prompted with a message saying "Your software is Out of Date". If I hit "Not Now" for an update, the emulator throws up a blank screen, And if I update it, then I get a Parsing error on the emulator screen (as attached).

When I click Ok on that Parsing Error screen, It takes me back to "Waiting for Blocks" screen and doesn't do anything beyond it.

I have tried uninstalling and re-installing the aistarter, as well as hard resetting several times. I have even unblocked firewall settings for port 8000 through to 8005, and also tried with having my firewall settings off entirely.  However, the 127.0.0.1:8001 URL takes me to the page as attached.




--
Sorry for the slow response. And THANKS for the screenshot, particularly showing the output of 127.0.0.1:8001, as that points to the problem!

Look for a directory named ".appinventor" off of your home directory (it may be hidden). Without the Emulator running, remove everything in this directory (or remove the entire directory) and then try the emulator again. Hopefully it will now permit you to update your Companion and to otherwise work correctly.

--
Thanks Jeff... No response... am closing this issue.

--