[OpenLayers-Users] GPS coordinate (GPS from mobile devices), lonlat and OpenLayers.Icon

Nicholas Efremov-Kendall n.e.kendall at gmail.com
Wed Jul 13 09:42:26 EDT 2011


Wait...I'm confused...

enablehighaccuracy with a timeout set to earlier will get the high accuracy
coords and get you the speed you want because it will use a cached location
and not fire up the gps on the device, but it will give you the accuracy you
want. If you're not using it as set to true, you're doing geoloc based on
cell towers or ip...

as for what you use to get the coords, I'm using the same thing, aren't I?
or am I missing something else here...

thanks for the link, here's one I found useful.
http://mobile.tutsplus.com/tutorials/mobile-web-apps/html5-geolocation/


On Wed, Jul 13, 2011 at 8:35 AM, Noli Sicad <nsicad at gmail.com> wrote:

> Thanks for the tip.
>
> However, I rather do the GPS, since this is native app (hybrid app -
> Xcode and JS) and use
>
>  position.coords.latitude
>  position.coords.longitude
>
> See the advantage here:
>
> http://www.thecssninja.com/javascript/geolocation-iphone
>
> Noli
>
> On 7/13/11, Nicholas Efremov-Kendall <n.e.kendall at gmail.com> wrote:
> > set : enablehighaccuracy to True, that actually access the GPS on the
> > devices.
> >
> > On Wed, Jul 13, 2011 at 1:02 AM, Noli Sicad <nsicad at gmail.com> wrote:
> >
> >> Hi,
> >>
> >> I would like to replace the Geolocate control functionality to reading
> >> from the GPS from mobile devices (e.g. iPhone and iPad 2). Geolocate
> >> html5 is so off from the actual real coordinate (lonLat) like 500
> >> metres away.
> >>
> >> How are do I am going to do this in easiest and nicer way?
> >>
> >> I am able to get the my current location (i.e. lon and lat values)
> >> from the iPhone/ iPad  GPS  to HTML DOM (i.e. Textbox).
> >>
> >> e.g.
> >>
> >> jQTouch with Xcode,
> >>
> >> <ul class="edit rounded">
> >>      <li>Longitude: <input id='lng' type="text" value='' /></li>
> >>      <li>Latitude: <input id='lat' type="text" value='' /></li>
> >> </ul>
> >>
> >> Now, the question is, would I be able to get icon from the local
> >> directory, not from http server?
> >>
> >> In this example below, it seems that OpenLayers.Icon is retrieved from
> >> http server.
> >>
> >> ~~~~~~
> >> var icon = new OpenLayers.Icon('
> >> http://www.openstreetmap.org/openlayers/img/marker.png',size,offset);
> >> layerMarkers.addMarker(new OpenLayers.Marker(lonLat,icon));
> >> ~~~~~~
> >> from,  http://wiki.openstreetmap.org/wiki/Openlayers_Track_example
> >>
> >> If not, would vector maker good option for this?
> >>
> >> In this example, http://openlayers.org/dev/examples/geolocation.html
> >>
> >> How can I mapulated this function to cater to the lon and lat values
> >> from the GPS?
> >>
> >> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> >> var geolocate = new OpenLayers.Control.Geolocate({
> >>    bind: false,
> >>    geolocationOptions: {
> >>        enableHighAccuracy: false,
> >>        maximumAge: 0,
> >>        timeout: 7000
> >>    }
> >> });
> >> map.addControl(geolocate);
> >> var firstGeolocation = true;
> >> geolocate.events.register("locationupdated",geolocate,function(e) {
> >>    vector.removeAllFeatures();
> >>    var circle = new OpenLayers.Feature.Vector(
> >>        OpenLayers.Geometry.Polygon.createRegularPolygon(
> >>            new OpenLayers.Geometry.Point(e.point.x, e.point.y),
> >>            e.position.coords.accuracy/2,
> >>            40,
> >>            0
> >>        ),
> >>        {},
> >>        style
> >>    );
> >>    vector.addFeatures([
> >>        new OpenLayers.Feature.Vector(
> >>            e.point,
> >>            {},
> >>            {
> >>                graphicName: 'cross',
> >>                strokeColor: '#f00',
> >>                strokeWidth: 2,
> >>                fillOpacity: 0,
> >>                pointRadius: 10
> >>            }
> >>        ),
> >>        circle
> >>    ]);
> >>    if (firstGeolocation) {
> >>        map.zoomToExtent(vector.getDataExtent());
> >>        pulsate(circle);
> >>        firstGeolocation = false;
> >>        this.bind = true;
> >>    }
> >> });
> >> geolocate.events.register("locationfailed",this,function() {
> >>    OpenLayers.Console.log('Location detection failed');
> >> });
> >> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> >>
> >> Any ideas and implementation how to do this?
> >>
> >> Thanks.
> >>
> >> Regards, Noli
> >> _______________________________________________
> >> Users mailing list
> >> Users at lists.osgeo.org
> >> http://lists.osgeo.org/mailman/listinfo/openlayers-users
> >>
> >
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-users/attachments/20110713/ba43e059/attachment-0001.html


More information about the Users mailing list