Select to view content in your preferred language

Display GPS Location in Flexviewer

4381
10
04-11-2011 05:23 AM
KeithGerhartz1
Occasional Contributor II
Has anyone developed code that would allow one to display the current GPS location in the Flex Viewer? Would appreciate any informed comment on this topic. Thanks.
Tags (2)
0 Kudos
10 Replies
KeithGerhartz1
Occasional Contributor II
Can anyone provide some useful input? ESRI?
0 Kudos
SimonLiu
Deactivated User
Hi

I would recommend having a look at the GeolocationWidget from the Flex Viewer Code Gallery

You can see a live example at

http://www.goodrichs.net/flexgeo/

The widget estimates your location from your IP address, so it's not derived from GPS, although it uses the same coordinate system as GPS (you would most likely be running Flex Viewer on a laptop/desktop that doesn't have built-in GPS anyway).
0 Kudos
DonCopple
Deactivated User
Ah, but my tablet does have built in GPS.  It will display a flexmap.  I too would like to know an answer to this question.
0 Kudos
ReneRubalcava
Frequent Contributor II
The GeoLocation widget linked above will fallback to IP location, but default is to use the HTML5 Geolocation. As far as GPS on a tablet, a Flex web app wouldn't be able to access a Tablets resources in that fashion. If it was deployed as an AIR application, like on an Android tablet, I do believe AIR for Android can access the device GPS, but I have not tried this.
0 Kudos
DonCopple
Deactivated User
I am still looking for one that will let me connect my GPS to a laptop as well, Anyone developed anything out there yet.  I did find a GPX loader in the code Gallery, but it doesn't work.
0 Kudos
DonCopple
Deactivated User
I looked at the code you mentioned, while cool and all, I already know the location of the server IP I am using.  Need a widget that would show you Lat/Lon from an attached device.  GPX Widget would be nice as well for uploading GPS tracks and waypoints from an attached unit.
0 Kudos
NathanEnge
Esri Contributor
the gpx loader works for me. request a sample of the .gpx csv file from the author.

its not a very robust loader, but it can be made that way.
0 Kudos
EricGeddes
New Contributor II
With some constraints, this is totally do-able...

At v10.3 and v3, respectively, neither Flash Player nor AIR support flash.sensors.Geolocation for desktop profiles (e.g. not mobile). [This is your cue to go tell Adobe this is important by voting for the enhancement request, and bug ESRI to apply some pressure on our behalf.]

However, that definitely doesn't mean there aren't reasonable ways to work around it for some applications, including at least some of the common activities one might use the (ArcGIS Flex) Viewer or API. Until Adobe gets around to adding this capability, we're left with the problem of grabbing NMEA (or similar) geolocation data from the desktop host's API, and getting it into our Flash app.

If we're building an AIR app, we could use a Native Process -- a platform-native application that gets silently installed with the AIR app, controlled by it, and becomes accessible to it. Since I'm deploying to ruggedized Windows 7 tablets, I'd give the free Geosense AirBridge a go.

That won't help if the app needs to run in a browser (alongside a Silverlight-based CMMS client, for example). The most painless approach is to deploy a web service on the local machine to access the Location API and return the result. This kind of web-service server, or "daemon", needn't require much in the way of resources (memory and CPU cycles) or configuration.

So we choose either an off-the-shelf solution, or to varying degrees, to make our own.

Microsoft finally made it easy to do such a thing... as long as you're comfortable coding against the .NET APIs. It's much easier if the (internal or external) GPS reports to Window's LocationAPI -- usually something the hardware vendor takes care of in the driver. If not, we could always swap in a library that exposes the data more explicitly.

Then it's a matter of reading the current location and exposing it as a service the Flash Player can call, and wiring it up using the WSDL code generation capabilities in Flash Builder.

Or we could just use an existing domain-specific off-the-shelf application designed to do just that. For free. Or less than $100US.

Somewhere in between are open-source, cross-platform programs that read the data from the GPS unit, and expose it as a web service for precisely the purposes we would apply it to.

However we make it work, we gain access to real-time location data in Flash/Flex -- and accordingly, thank you ArcGIS Flex API team, in our GIS. For free. What's more, aside from the handful of MXML that populates our variables (via binding, of course), we could do it without having to write any code (unless we wanted to).

Eric Geddes
Visionary, Troublemaker, Cartographer, Database Developer, GIS Specialist
City of San Luis Obispo, California
0 Kudos
JasonMcClure
Deactivated User
Has there been any progress made on this?  We're going to be deploying ruggedized Windows tablets into the field and it would be amazing to have GeoLocation available as an option for our WebMap.
0 Kudos