0

How to get geographical location from mobile

hi
I'm developing a mobile application that finds the closest transit with php using blueprint php library.

I can't find how to get geographical location from the mobile. I know i can use location-chooser and also i added the a<allow-location /> in my config.xm

But what i really need is to get latitude and longitude or whatever that geo data supports blueprint and store it in 2 variables so later i could compare it with the closest bus stop..

I'd really appreciate any help.

Thanks in advance.

by
10 Replies
  • QUOTE (ilias_mantis @ Apr 27 2009, 06:18 AM) <{POST_SNAPBACK}>
    I can't find how to get geographical location from the mobile. I know i can use location-chooser and also i added the a<allow-location /> in my config.xm


    You will have to use the location chooser in order to get this data. Depending on the environment where the user accesses your service, the platform will either display a "Find Me" button to automatically get the user's location or display a text-input field where the user can specify its location. Even if the user enters its location manually in this case - the platform will still do a geolocation-search and provide you with the appropriate data that you need.

    Markus
    0
  • QUOTE (Markus @ Apr 27 2009, 05:06 PM) <{POST_SNAPBACK}>
    Even if the user enters its location manually in this case - the platform will still do a geolocation-search and provide you with the appropriate data that you need.


    Really? I was under the impression that pure web apps had no access to the iPhone's geo-location or geo-suggest capabilities.
    0
  • QUOTE (Benjamin Hill @ Apr 28 2009, 11:17 AM) <{POST_SNAPBACK}>
    Really? I was under the impression that pure web apps had no access to the iPhone's geo-location or geo-suggest capabilities.


    Yes, that is right. The difference with the <location-chooser> is that after the user enters a specific location manually, Yahoo! uses its infrastructure and provides back to you more relevant location data.

    For example: The user types in "San Francisco" the Y! Blueprint back-end will run a geo-location search on this search term and provide you back with much more detailed data such as San Francisco, ZIP-Code 94109, California, US etc.
    0
  • hi, thanks for the reply. After the user finds his location with the location chooser, is it possible to save hi geo location output to a variable?
    0
  • QUOTE (ilias_mantis @ Apr 29 2009, 01:16 PM) <{POST_SNAPBACK}>
    hi, thanks for the reply. After the user finds his location with the location chooser, is it possible to save hi geo location output to a variable?


    if you have <location> in ur model and your location-chooser refer to it, when ur user submit the form you will receive longitude/latitude/city/country/etc POST vars.

    you can preinitialize the <location> before, eg. <location><latitude>-6.123</latitude><longitude>123.01232</longitude></location>
    by looking at request headers http://developer.yahoo.com/mobile/blueprin...TP_Headers.html

    cmiiw
    0
  • QUOTE (Markus @ Apr 27 2009, 05:06 PM) <{POST_SNAPBACK}>
    You will have to use the location chooser in order to get this data. Depending on the environment where the user accesses your service, the platform will either display a "Find Me" button to automatically get the user's location or display a text-input field where the user can specify its location. Even if the user enters its location manually in this case - the platform will still do a geolocation-search and provide you with the appropriate data that you need.

    Markus


    so on GPS enabled devices, the app will be able to access that info?
    0
  • If your service runs within the Yahoo! Go client (in this case your BP service has to be written in Blueprint 1.0) and the device is GPS enabled, then it will be able to use the GPS location.

    GPS location is not available when the user runs your service in the mobile browser.
    0
  • Thanks for the help guys, i finished my application a week ago.
    I used the $lat = $_GET['latitude']; $lon = $_GET['longitude']; to get coordinates.

    This is a part of the code i used to get longitude and latitude.

    CODE
    <page id="location_chooser"> 
    <models>
    <model>
    <instance>
    <location-data xmlns="">
    <search_location>
    <latitude />
    <longitude />
    <name />
    <street />
    <city />
    <state />
    <zip />
    <country />
    </search_location>
    </location-data>
    </instance>
    <submission method="get" resource="your_page_to_send_the_coordinates.php" />
    </model>
    </models>
    <page-header>
    <masthead>
    <layout-items>
    <block class="title">Choose Location</block>
    </layout-items>
    </masthead>
    </page-header>
    <content>
    <module>
    <block>Find your location then click on Submit</block>

    <location-chooser
    ref="search_location">
    <label>Location:</label>
    </location-chooser>

    <submit>
    <label>Submit</label>
    </submit>
    </module>
    </content>
    </page>
    0
  • QUOTE (ilias_mantis @ May 18 2009, 06:21 PM) <{POST_SNAPBACK}>
    Thanks for the help guys, i finished my application a week ago.
    I used the $lat = $_GET['latitude']; $lon = $_GET['longitude']; to get coordinates.


    Does this code now work for you or are you still seeing problems?
    0
  • QUOTE (spieri @ May 19 2009, 12:39 PM) <{POST_SNAPBACK}>
    Does this code now work for you or are you still seeing problems?


    hello, i tried the code above and not working for me, i'm not getting any value from $_GET['latitude'] or $_GET['longitude]
    i also try using POST method and didn't work too, is there anybody got this map stuff working , help me please. i'm using iphone 2G. thx
    0
This forum is locked.

Recent Posts

in Blueprint General Discussion