Page 1 of 1

Map of Cities initialized to current position-working sample

Posted: Wed Apr 18, 2012 10:57 pm
by BarrySumpter
Aren't solutions so simple?
I feel like such a hack.
It took me hours n hours to finally get this to work.

I started with the map of cities sample app contributed by Dixie.

With references to:
how-do-i-use-core-location-in-revmobile
http://lessons.runrev.com/s/lessons/m/4 ... -revmobile
And converted the sample to Android.
Converted app alread posted in this forum somewhere.

Don't know why my previous tests wouldn't work.
It might have something to do with where the resizeStack was placed.
More likely lack of experience.

I've added Melbourne to the alphabetic list of cities.
I've added Current Location to the alphabetic list of cites into the first position.
Ive added Lat Lng text fields to the title bar.

LcNav.html has to be a file.
I tried to have is as a text field
but wouldn't work as the url nor when I saved the text field as a file.
I don't know why.

.

Map of Cities initialized to current position-working sample

Posted: Thu Apr 19, 2012 12:36 am
by BarrySumpter
Further research variations on this technique:
developers.google.com/maps/documentation/javascript/examples/
https://developers.google.com/maps/docu ... /examples/

Set Centre as home:
google-developers.appspot.com/maps/documentation/javascript/examples/control-custom-state
https://google-developers.appspot.com/m ... stom-state
I want to
Over lay a pointer on android browser to point to center so I can see the centre position of the map
move map behind to place on exact map position (say specific street corner or park or bike path entrance)
then get lat lng
then send to bike riding buddies to meet me here

Bicycling Layer as well!
google-developers.appspot.com/maps/documentation/javascript/examples/layer-bicycling
https://google-developers.appspot.com/m ... -bicycling

Anything with Directions

Distance Calc!
google-developers.appspot.com/maps/documentation/javascript/examples/distance-matrix
https://google-developers.appspot.com/m ... nce-matrix

places-autocomplete
google-developers.appspot.com/maps/documentation/javascript/examples/places-autocomplete
https://google-developers.appspot.com/m ... tocomplete

and the weather
google-developers.appspot.com/maps/documentation/javascript/examples/layer-weather
https://google-developers.appspot.com/m ... er-weather

OK completely overwhelmed with all the things google offers with google maps. WOW
:mrgreen:

Found something to keep me occupied for the next 6 weeks. LOL

Re: Map of Cities initialized to current position-working sa

Posted: Tue Apr 24, 2012 7:11 am
by BarrySumpter
BarrySumpter wrote: ...
LcNav.html has to be a file.
I tried to have is as a text field
but wouldn't work as the url nor when I saved the text field as a file.
I don't know why.

.
The HTML can be a text field.
And does NOT have to be an HTML file.

mobileControlDo id, "load", baseUrl, htmlText
Loads as page consisting of the given htmlText with the given baseUrl (wraps the
loadHtmlString method of UIWebView).

Code: Select all

...
put field txtMyHTMLText into myHTMLText
mobileControlDo sbrowserID, "load", "", myHTMLText
...

Re: Map of Cities initialized to current position-working sa

Posted: Wed Dec 11, 2013 12:46 pm
by LC4iOS
Just sharing ...

I stumbled on this looking for a solution to the Compass sample app from RunRev.
I couldn't get it to initialize the GPS.

I don't recall changing anything to it to work in iOS except StandAloneSettings.


I found this technique very interesting and super easy to use.
I've just popped the HTML into a text field so I don't have to keep up why the .html file.

Code: Select all

on showCityChoice cityShowing
   
   -- answer "showCityChoice: " & cityShowing
   
   if cityShowing = 0 then 
      -- answer "cityshowing = 0"
      exit showCityChoice
   end if
   
   
   
   
   
   -- changed theHTMLFile to field txtMyHTMLText
   
   
   
   --   put specialFolderPath("documents") & "/lcNav.html" into thehtmlFile
   
   --   /* change the latitude & longditude in the html file to display the chosen city */
   --   put URL("file:" & thehtmlFile) into theData
   --   put "var myLatlng = new google.maps.LatLng(" & item 2 to 3 of line cityShowing of fld "cityLocations" & ");" into line 16 of theData
   
   --   -- answer theData
   
   --   put theData into URL ("file:" & thehtmlFile)
   
   --   put "file://" & specialFolderPath("documents") & "/lcNav.html" into theURL
   --   replace space with "%20" in theURL
   
   --   mobileControlSet browserID, "url", theURL
   
  
   put field txtMyHTMLText into myHTMLText
   
   put "var myLatlng = new google.maps.LatLng(" & item 2 to 3 of line cityShowing of fld "cityLocations" & ");" into line 16 of myHTMLText
   
   mobileControlDo browserID, "load", "", myHTMLText
   
end showCityChoice


Re: Map of Cities initialized to current position-working sa

Posted: Mon Jan 20, 2014 11:12 pm
by LC4iOS
I'm thinking the HTML file is used to store the last requested gps position.
So on next open the map defaults to the last save gps position saved in the HTML file by opening it first thing.
Maybe not.
Can't recall if I update the gps positioning the HTML script before displaying the first time.

Re: Map of Cities initialized to current position-working sa

Posted: Tue Jan 21, 2014 1:46 am
by Dixie
LC4IOS...

This is from a stack that I wrote a long time ago, and I think it was with google maps API 2... it looks like people changed it for what they wanted it to do... the HTML file contains the HTML for the google map to place it on screen and so that you can enter the coordinates of the location you wish to view, drop markers and such... google have changed things around a little from a couple of years ago, but the card script still works after a little tweaking for the v3 API...

Re: Map of Cities initialized to current position-working sa

Posted: Tue Jan 21, 2014 2:21 am
by LC4iOS
Hi Dixie,
Thanks for that reply.
That sample project was an excellent example of lateral thinking.
And has heaps n heaps of potential for expansion.
Many thanks.