Identify if point is in the polygon

Just tried Ray Casting algorithm which identifies point in polygon. This works perfect. Refer http://en.wikipedia.org/wiki/Point_in_polygon for thesis of Ray-Casting private boolean isPointInPolygon(LatLng tap, ArrayList<LatLng> vertices) { int intersectCount = 0; for (int j = 0; j < vertices.size() – 1; j++) { if (rayCastIntersect(tap, vertices.get(j), vertices.get(j + 1))) { intersectCount++; } } return ((intersectCount % … Read more

Error adding geofences in Android (status code 1000)

You get GEOFENCE_NOT_AVAILABLE (code ‘1000’) when user disagrees to “Use Google’ location services” in Settings->Location->Mode: To fix it: go to Settings->Location->Mode set “Device only (Use GPS to determine your location)” set any other option to get the popup (e.g. “High accuracy (Use GPS, Wi-Fi and mobile networks to determine location”) dialog “”Use Google’ location services” … Read more

OnLocationChanged callback is never called

It looks like you setup should work, since it doesn’t, I would make your example as simple as possible in order to troubleshoot. I would make your request look like requestLocationUpdates(LocationManager.GPS_PROVIDER, 0, 0, locationListener); requestLocationUpdates(LocationManager.NETWORK_PROVIDER, 0, 0, locationListener); This way you get ALL the updates possible. And comment out the part about getting the last … Read more

Check if a geopoint with latitude and longitude is within a shapefile

Another option is to use Shapely (a Python library based on GEOS, the engine for PostGIS) and Fiona (which is basically for reading/writing files): import fiona import shapely with fiona.open(“path/to/shapefile.shp”) as fiona_collection: # In this case, we’ll assume the shapefile only has one record/layer (e.g., the shapefile # is just for the borders of a … Read more

Converting latitude and longitude to decimal values

To parse your input use the following. function ParseDMS(input) { var parts = input.split(/[^\d\w]+/); var lat = ConvertDMSToDD(parts[0], parts[1], parts[2], parts[3]); var lng = ConvertDMSToDD(parts[4], parts[5], parts[6], parts[7]); } The following will convert your DMS to DD function ConvertDMSToDD(degrees, minutes, seconds, direction) { var dd = degrees + minutes/60 + seconds/(60*60); if (direction == “S” … Read more

Which Devices Support Javascript Geolocation via navigator.geolocation?

As of today, the W3C Geolocation API (widely associated with, though not technically part of, HTML 5) is support in the following major desktop browsers: Firefox (since 3.5) Safari (since 5.0) Google Chrome (version depends on OS) Opera (since 10.60) Internet Explorer (since IE 9) There are at least two mobile browsers that implement the … Read more

how to redirect domain according to country IP address

Download the geoPlugin class from: http://www.geoplugin.com/_media/webservices/geoplugin.class.phps (free lookup limit of 120 requests per minute and block for 1h if crossed the limit. the block will automatically remove 1 hour after the last time your server stopped sending more than 120 requests a minute) Put a index.php file in your root folder: <?php require_once(‘geoplugin.class.php’); $geoplugin = … Read more