finding the exact latitude and longitude ngCordova geoloaction - angularjs

I am trying to get my exact latitude and longitude of my position using this http://mygeoposition.com/ website I am find my position currect
(lat-Copy (x,y)13.049517013° 2' 58.26'' N)(long-Copy (x°,y°)80.217491080° 13' 2.97'' E)
but my I am getting the lat and long as (lat-13.082680199999999 & long-80.2707184).
here is my plunk http://plnkr.co/edit/AQ9RzzOx2I3nVS8ix7EQ?p=preview I just need to show my lat and long in console.log

The reason why the lat & long value is showing (lat-13.082680199999999 & long-80.2707184) because of my lat-long internet connection and it shows the respected district lat & log values only. So, My code works fine.
After I run my project in my device I got the exact lat & long of current position.

Related

How to get the latitude and longitude in Open layers

I am drawing one line from Location A to Location B using React.JS with Open Layers. I wish to get the Latitude and Longitude of the Location A and Location B.
I have added one listener after draw completion. But it is giving the co-ordinates as below . How can I get the latitude and longitude?
Listener:
draw.on('drawend',function(e){
console.log("Co Ordinates :",e.feature.getGeometry())
//console.log("Co Ordinates :",e.feature.getGeometry().getExtent())
});
Console :
Extent and flat coordinates values are printed in console as below
extent_:(4) [8732987.679175382, 1920132.5190330548, 8735555.9637923, 1920254.817578509]
flatCoordinates:(4) [8732987.679175382, 1920132.5190330548, 8735555.9637923, 1920254.817578509]
If you are just looking for a way to convert the coordinates you can use ol.proj.transform(coordinate, source, destination)
Using this
ol.proj.transform([8732987.679175382, 1920132.5190330548], 'EPSG:3857', 'EPSG:4326')
Will give this as output
[78.44976308230713, 16.99405070970775]
Also note that you can use getFirstCoordinate and getLastCoordinate methods on the line feature to get the first and last coordinates.
OpenLayer is working on different location formats like EPSG: 3857, EPSG: 4285 etc.
There are some Transform/Projection api enter link description here
Use this api's and transfer your locations to your desired formats

Latitude out of bounds

I get following exception when using Entity Framework to get data from bounds from a google map:
FormatException: 24201: Latitude values must be between -90 and 90 degrees.
POLYGON((81.9882716924738 140.187434563007,21.5587046599696 140.187434563007,21.5587046599696 -40.1641279369925,81.9882716924738 -40.1641279369925,81.9882716924738 140.187434563007))
I can see other have same problem, but havent found anything that solves this. I would expect that first coordinate for point is the latitude and second for longitude? And none is above 90 so why do I get this error? I tried swapping lat and lng but with same problem.
This is the failing line:
var poly = FindByBoundingBox(northEastLat, northEastLng, southWestLat, southWestLng);
DbGeography polygon = DbGeography.FromText(poly, 4326);
var parksWithinPolygon = dbCtx.SiteList.Where(p =>
p.PolygonCenter.Intersects(polygon)).Select(p=>p.SiteName).ToList();
As Damien states first problem is that Sql server expects longitude first and then lattitude. This throws another error, redirecting to another problem:
"This operation cannot be completed because the instance is not valid".
My best bet is it's the they way/order I build the polygon. Has anyone succeeded in mapping google bounds to a polygon in SQL server? In short I am trying to get any data (data has a point column) within the google map bounds.
The function to calculate polygon is listed below:
public string FindByBoundingBox(double northEastLat, double northEastLng, double southWestLat, double southWestLng)
{ //Create poylgon of bounding box
System.Globalization.CultureInfo customCulture = (System.Globalization.CultureInfo)System.Threading.Thread.CurrentThread.CurrentCulture.Clone();
customCulture.NumberFormat.NumberDecimalSeparator = ".";
System.Threading.Thread.CurrentThread.CurrentCulture = customCulture;
var bboxWKT = string.Format("POLYGON(({1} {0},{1} {2},{3} {2},{3} {0},{1} {0}))", northEastLat, northEastLng, southWestLat, southWestLng);
return bboxWKT;
}
OK i figured it out. As Damien stated the order of coordinates is oppesite of google. In SQL long needs to be first. Next thing is what is the "left hand rule". You need to create your polygon starting from lower left corner and then counter clock wise.

define geofence around location stored in array

I am working on an app where I have a set of pre-defined co-ordinates stored in an array like the one below:
var SpeedcameraLocationDictionary: [[String : AnyObject]] = [
["camindex": "1a", "Latitude":xxxx, "Longitude":xxxx,"Distance":34, "legalspeed":110],
["camindex": "1b", "Latitude":xxxx, "Longitude":xxxx,"Distance":34, "legalspeed":110],
["camindex": "2a", "Latitude":xxxx, "Longitude":xxxx,"Distance":26, "legalspeed":110],
["camindex": "2b", "Latitude":xxxx, "Longitude":xxxx,"Distance":26, "legalspeed":110]]
What I want to do is, when the users location matches any lat & long in the array (+ or - 5 meters) , start doing some calculations. I have variables set up to hold the lat & long of the user, and the relevant CLLocation manager. Implanting on checking the users location every 30 secs, so i have a timer set up to trigger at 30sec intervals.
I believe I need to set up a geofence around the relevant point, but I'm not really sure how to do the check & set up.
I imagine it would be along the lines of the following:
if Timer = 30secs
let region = CLCircularRegion(center: Latitudefromarray,longitudefromarray, radius: 5,)
if (Latitude +/- 5m == region AND longitude +/- 5m == region)
do calculations....
could somebody either point me in the direction of a tutorial that could help me achieve this goal, or provide some sample code to achieve the goal I'm after? i have been following this tutorial but am struggling to adapt it to my needs.
Thanks

Time out issue in classic ASP

I am working on a classic ASP project where I am getting time out issue when populating the data from DB and Bind it in the UI. The following error we got:
Script timeout
The maximum amount of time for a script tp execute was exceeded. You can change this limit by specifying new value for the property Server.Scripttimeout or by changing the value in IIS asministration tools
To resolve the issue we tried to do the pagination but it went unsuccessful.
There are several forms on one page with individual names (i.e. form1, form2) . We have implemented Recordset pagination within one particular form.
Along with the pagination edit and delete options are also available for a particular record in record set. The problem what we are facing is when we try to edit the record the form values are not coming to the posted page.
I have mentioned the code snippet as below:
Function someFunction
data1=""
<form name="Xyz" method="post" action="edit.asp">
s=s&"<script>function relsubmit() {alert(" & data1 &"); rjob.submit(); } </script>"
'Pagination code display only 30 records per page
Do While Not ( rss.Eof Or rss.AbsolutePage <> iPage )
'some code
If (Action="RELEdit") Then
s=s&"" & drsel &""
s=s&"
s=s&"" & clean(rss.Fields(4).value) & ""
Else
End If
datadr1=datadr1& rss.Fields(0).value & ","
rss.MoveNext
loop
If (Action="RELEdit") then
s=s&"<input type=hidden name=data1 value=""" & datadr1 & "">"
s=s&"<input type=hidden name=data2 value=""" &datadr2 & """><</form>"
End If
End Function
We have tried to get the value in edit.asp page using request.form("data1") the values are coming empty also we tried alert in the relsubmit() function it is showing as empty.
Can you please help me why the form values are posted as null or empty.
Also, please advise me if we have any other approaches to track the time out.
Place this code at the top of the ASP page you are running.
The values are in seconds (300 = 60*5 = 5 minutes)
This will extend the script runtime to 5 minutes. You can set any value even hours
<%Server.ScriptTimeout=600%>

Google Maps coordinates in KML

I'm trying to use kml for rendering geo-coordinates in google maps.
Unfortunately, I have some troubles with coordinates: when I insert in KML coordinates from Google maps, and then pass this KML file to google maps service, placemarks points to another place in the Earth.
Maybe I dont guess format of placemark location for KML ?
Sometimes Google Maps will report coordinates in "Degrees, Minutes, Seconds" (DMS) notation, which can look like this: 37°48'21.0"N 122°27'57.6"W.
KML needs coordinates in "Decimal Degrees" (DD) notation, which would look like this: -122.466001, 37.805828. Note that KML also expects the order Longitude, Latitude, which is different from many other places, which show Latitude then Longitude.
So... if you're somehow getting your coordinates in DMS notation, then you'll need to convert to DD notation, and make sure the Lon,Lat order is correct.
in the KML file i have the LatLng was backwards.
KML => -.709448,54.009222,0
gmaps => 54.009222,-.709448
use pandas to read cvs into df
then use simplekml to export it into lml
Note: coords is (lon,lat,height) # lon, lat, optional height
example:
import simplekml
snet_kml='test.kml'
kml = simplekml.Kml()
for name,lat,lon,height in zip(snet[NAMES[0]], snet[NAMES[1]], snet[NAMES[2]], snet[NAMES[3]]):
kml.newpoint(name=name, coords=[(lon,lat,height)]) # lon, lat, optional height
print("*** Created {}".format(snet_kml))
print(kml.kml())
kml.save(snet_kml)

Resources