+ Reply to Thread
Results 1 to 11 of 11

Thread: GPS locator not working for Election Polling Place ver 2.2

  1. #1
    Brandon Van Horn
    Join Date
    Oct 2011
    Posts
    17
    Points
    2
    Answers Provided
    1


    0

    Default GPS locator not working for Election Polling Place ver 2.2

    Hello I am trying to get the GPS locator working on this application. I keep getting "You are currently outside the supported area" dialog box. Everything but this is working. Are their any settings that have to be set to use this functionality? Thanks for your help.

    Brandon

  2. #2
    Brandon Van Horn
    Join Date
    Oct 2011
    Posts
    17
    Points
    2
    Answers Provided
    1


    1
    This post is marked as the answer

    Default Re: GPS locator not working for Election Polling Place ver 2.2

    I figured it out. The GPS locater was returning the location value in latitude and longitude. Therefor the location value did not fall with in the full extent value. That is because the values that are being used for the full extent are in Web Mercator Projection. Any the code to fix this is below.

    Class: utls.js


    navigator.geolocation.getCurrentPosition(
    function (position) {
    ShowProgressIndicator();
    mapPoint = esri.geometry.geographicToWebMercator(new esri.geometry.Point(position.coords.longitude, position.coords.latitude, new esri.SpatialReference({ wkid: 4326 }))); //Changed this line to include "esri.geometry.geographicToWebMercator("
    var graphicCollection = new esri.geometry.Multipoint(new esri.SpatialReference({ wkid: 102100 })); //changed wkid: 102100 Web Mercator
    graphicCollection.addPoint(mapPoint); //graphicCollection.addPoint(mapPoint)
    geometryService.project([graphicCollection], map.spatialReference, function (newPointCollection) {
    for (var bMap = 0; bMap < baseMapLayers.length; bMap++) {
    if (map.getLayer(baseMapLayers[bMap].Key).visible) {
    var bmap = baseMapLayers[bMap].Key;
    }
    }
    if (!map.getLayer(bmap).fullExtent.contains(mapPoint)) {
    map.infoWindow.hide();
    selectedPollPoint = null;
    pollPoint = null;
    mapPoint = null;
    ClearSelection();
    map.getLayer(tempGraphicsLayerId).clear();
    map.getLayer(precinctLayerId).clear();
    map.getLayer(routeGraphicsLayerId).clear();
    map.getLayer(highlightPollLayerId).clear();
    HideProgressIndicator();
    if (!isMobileDevice) {
    var imgToggle = dojo.byId('imgToggleResults');
    if (imgToggle.getAttribute("state") == "maximized") {
    imgToggle.setAttribute("state", "minimized");
    WipeOutResults();
    dojo.byId('imgToggleResults').src = "images/up.png";
    }
    }
    ShowInfoDetailsView();
    alert(messages.getElementsByTagName("geoLocation")[0].childNodes[0].nodeValue);
    return;
    } else { //Added the else statement.
    mapPoint = newPointCollection[0].getPoint(0);
    LocateAddressOnMap(false);
    }
    });
    },
    function (error) {
    HideProgressIndicator();
    switch (error.code) {
    case error.TIMEOUT:
    alert(messages.getElementsByTagName("geolocationTimeout")[0].childNodes[0].nodeValue);
    break;
    case error.POSITION_UNAVAILABLE:
    alert(messages.getElementsByTagName("geolocationPositionUnavailable")[0].childNodes[0].nodeValue);
    break;
    case error.PERMISSION_DENIED:
    alert(messages.getElementsByTagName("geolocationPermissionDenied")[0].childNodes[0].nodeValue);
    break;
    case error.UNKNOWN_ERROR:
    alert(messages.getElementsByTagName("geolocationUnKnownError")[0].childNodes[0].nodeValue);
    break;
    }
    }, { timeout: 10000 });
    }


    Hope this helps someone else out. Have a great day.

    Brandon

  3. #3
    Allison Muise
    Join Date
    Aug 2010
    Posts
    21
    Points
    8
    Answers Provided
    2


    0

    Default Re: GPS locator not working for Election Polling Place ver 2.2

    Thank you for pointing this out, Brandon.

    We will definitely look into resolving this.

    -Allison Muise

    Product Engineer
    ArcGIS for Local Government

  4. #4
    David Kaufman
    Join Date
    Mar 2011
    Posts
    4
    Points
    0
    Answers Provided
    0


    0

    Smile Re: GPS locator not working for Election Polling Place ver 2.2

    Quote Originally Posted by vanhornsky View Post
    mapPoint = esri.geometry.geographicToWebMercator(new esri.geometry.Point(position.coords.longitude, position.coords.latitude, new esri.SpatialReference({ wkid: 4326 }))); //Changed this line to include "esri.geometry.geographicToWebMercator("
    var graphicCollection = new esri.geometry.Multipoint(new esri.SpatialReference({ wkid: 102100 })); //changed wkid: 102100 Web Mercator

    Thanks, these lines worked for me in the Park Finder app for the geolocation.

  5. #5
    Jordan Brod
    Join Date
    Apr 2011
    Posts
    68
    Points
    7
    Answers Provided
    2


    0

    Default Re: GPS locator not working for Election Polling Place ver 2.2

    I have tried this method and while it does make the button work it seems to misplace the gps or computer location by half a mile or so from where one is actually located, any idea what could be causing this?

  6. #6
    Brandon Van Horn
    Join Date
    Oct 2011
    Posts
    17
    Points
    2
    Answers Provided
    1


    0

    Default Re: GPS locator not working for Election Polling Place ver 2.2

    Are you using a GPS?
    The GPS on the phone\ tablets usually work really well. Within some acceptable tolerances.

    ..or are you trying to locate the computer?
    From what I can figure is the computer location is based on where the IP address is registered. This usually gets you within a town\ city but not always.
    Like a zip code

    Information link on the different type of locations
    http://mobile.tutsplus.com/tutorials...5-geolocation/

    Good Luck,
    Brandon
    Last edited by vanhornsky; 06-08-2012 at 01:48 PM. Reason: Add more information
    Have a great day.

    Brandon

    Yavapai County Government
    GIS Programmer/Analyst

  7. #7
    Jordan Brod
    Join Date
    Apr 2011
    Posts
    68
    Points
    7
    Answers Provided
    2


    0

    Default Re: GPS locator not working for Election Polling Place ver 2.2

    The GPS on a phone had the greatest inaccuracy the computer just puts us across the street, the gps put us in another part of town. Is your main data in the localgovernment.gdb in your local coordinate system or are you putting it into the web mercator projection?

  8. #8
    Brandon Van Horn
    Join Date
    Oct 2011
    Posts
    17
    Points
    2
    Answers Provided
    1


    0

    Default Re: GPS locator not working for Election Polling Place ver 2.2

    Well we have customized the code to use our SQL database. This is in WebMercator.
    Have a great day.

    Brandon

    Yavapai County Government
    GIS Programmer/Analyst

  9. #9
    Jordan Brod
    Join Date
    Apr 2011
    Posts
    68
    Points
    7
    Answers Provided
    2


    0

    Default Re: GPS locator not working for Election Polling Place ver 2.2

    All of our data in our sql database is in the State Plane system then all of our webmaps are in the Web Mercator Aux projection(the form the come in the templates). So I don't know if the cause of the inaccuracy is because of this or if something else is going on. Could also be a bad time of day for taking GPS, but I wouldn't expect the phone to throw us this far off.

  10. #10
    Brandon Van Horn
    Join Date
    Oct 2011
    Posts
    17
    Points
    2
    Answers Provided
    1


    0

    Default Re: GPS locator not working for Election Polling Place ver 2.2

    Sorry I don't know about that. I just checked my computer and my phone at the same site and I am experiencing the opposite of what you are. My GPS is approx 25- 50 feet away from my location. While my computer is 2-3 miles away. Our production database is in State Plane, then we reproject to WebM for our online database. Our services are pointing to the Web database. I don't think this has anything to do with it though. Sorry I cant help you more.
    Have a great day.

    Brandon

    Yavapai County Government
    GIS Programmer/Analyst

  11. #11
    Scott Oppmann
    Join Date
    Dec 2009
    Posts
    103
    Points
    40
    Answers Provided
    5


    0

    Default Re: GPS locator not working for Election Polling Place ver 2.2

    We posted an update to the Polling Place app this week that resolves several issues with Geolocation. Please check out the latest release.

+ Reply to Thread

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts