Search Results

Search found 523 results on 21 pages for 'lat'.

Page 3/21 | < Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >

  • Creating a fixed length output string with sprintf containing floats

    - by Kungi
    Hi, I'm trying to create a file which has the following structure: - Each line has 32 bytes - Each line looks like this format string: "%10i %3.7f %3.7f\n" My Problem is the following: When i have a negative floating point numbers the line gets longer by one or even two characters because the - sign does not count to the "%3.7f". Is there any way to do this more nicely than this? if( node->lng > 0 && node->lat > 0 ) { sprintf( osm_node_repr, "%10i %3.7f %3.7f\n", node->id, node->lng, node->lat ); } else if (node->lng > 0 && node->lat < 0) { sprintf( osm_node_repr, "%10i %3.7f %3.6f\n", node->id, node->lng, node->lat ); } else if (node->lng < 0 && node->lat > 0) { sprintf( osm_node_repr, "%10i %3.6f %3.7f\n", node->id, node->lng, node->lat ); } else if ( node->lng < 0 && node->lat < 0 ) { sprintf( osm_node_repr, "%10i %3.6f %3.6f\n", node->id, node->lng, node->lat ); } Thanks for your Answers, Andreas

    Read the article

  • Getting a handle on GIS math, where do I start?

    - by Joshua
    I am in charge of a program that is used to create a set of nodes and paths for consumption by an autonomous ground vehicle. The program keeps track of the locations of all items in its map by indicating the item's position as being x meters north and y meters east of an origin point of 0,0. In the real world, the vehicle knows the location of the origin's lat and long, as it is determined by a dgps system and is accurate down to a couple centimeters. My program is ignorant of any lat long coordinates. It is one of my goals to modify the program to keep track of lat long coords of items in addition to an origin point and items' x,y position in relation to that origin. At first blush, it seems that I am going to modify the program to allow the lat long coords of the origin to be passed in, and after that I desire that the program will automatically calculate the lat long of every item currently in a map. From what I've researched so far, I believe that I will need to figure out the math behind converting to lat long coords from a UTM like projection where I specify the origin points and meridians etc as opposed to whatever is defined already for UTM. I've come to ask of you GIS programmers, am I on the right track? It seems to me like there is so much to wrap ones head around, and I'm not sure if the answer isn't something as simple as, "oh yea theres a conversion from meters to lat long, here" Currently, due to the nature of DGPS, the system really doesn't need to care about locations more than oh, what... 40 km? radius away from the origin. Given this, and the fact that I need to make sure that the error on my coordinates is not greater than .5 meters, do I need anything more complex than a simple lat/long to meters conversion constant? I'm knee deep in materials here. I could use some pointers about what concepts to research. Thanks much!

    Read the article

  • NoSQL: How to retrieve a 'house' based on lat & long?

    - by Tedk
    I have a NoSQL system for storing real estate houses. One piece of information I have in my key-value store for each house is the longitude and latitude. If I wanted to retrieve all houses within a geo-lat/long box, like the SQL below: SELECT * from houses WHERE latitude IS BETWEEN xxx AND yyy AND longitude IS BETWEEN www AND zzz Question: How would I do this type of retrival with NoSQL ... using just a key-value store system? Even if I could do this with NoSQL, would it even be efficient or would simply going back to using a tradition database retrieve this type of information faster?

    Read the article

  • Using Google Weather API with Lat and Lon - how to format?

    - by Paul
    I am wanting to use the Google Weather API - by passing lat and long values. However it seems Google is needing these formatted differently to the values I have stored. i.e. For the town of McTavish I have values of 45.5 and -73.583 This works here: http://api.wunderground.com/auto/wui/geo/WXCurrentObXML/index.xml?query=45.5,-73.583 But when I use Google it does not: See: www.google.com/ig/api?weather=,,,45.5,-73.583 Any help appreciated. I would prefer to use the Google Data.

    Read the article

  • How to very efficiently assign lat/long to city boundary described by shape ?

    - by watcherFR
    I have a huge shapefile of 36.000 non-overlapping polygones (city boundaries). I want to easily determine the polygone into which a given lat/long falls. What would the best way given that it must be extremely computationaly efficient ? I was thinking of creating a lookup table (tilex,tiley,polygone_id) where tilex and tiley are tile identifiers at zoom levels 21 or 22. Yes, the lack of precision of using tile numbers and a planar projection is acceptable in my application. I would rather not use postgres's GIS extension and am fine with a program that will run for 2 days to generate all the INSERT statements.

    Read the article

  • Given the lat/lon of 2 close points on earth (<10m), How do I calculate the distance in metres?

    - by Rory
    I have the lat/lon of 2 points on the earth. They are really close together, <10m. Let's assume the earth is flat. How do I calculate the distance between them in metres? I know about tools (PostGIS, etc.) that can do this correctly, however I'm just doing a rough and ready type, and I'm OK with low accuracy. At such small sizes a difference of 1% is only 10cm, which is fine for me. I'm doing this in stock python. I'm OK with a standard Euclidean distance thing.

    Read the article

  • TomTom integration does not work anymore?

    - by viezel
    I did for 6 months back an integration for TomTom navigation with URL Scheme. This worked out great, but then TomTom updated their iPhone app to version 1.10. Since then the integration does not work. Anyone tried the same? My iOS integration looks like this: (Titanium appcelerator) var lat = dbDataArray[chosenRoute]["lat"].toFixed(6); //geo coordinate var lng = dbDataArray[chosenRoute]["lng"].toFixed(6); //geo coordinate //open navigation var url = "tomtomhome://geo:action=navigateto&lat="+lat+"&long="+lng+"&name=name"; //show map //var url = "tomtomhome://geo:action=show&lat="+lat+"&long="+lng+"&name=name"; if (Ti.Platform.canOpenURL(url)) { Ti.Platform.openURL(url); }else { alert('Please install TomTom Navigation app'); } Note: I cannot get TomTom to tell me what has changed.

    Read the article

  • Routes on a sphere surface - Find geodesic?

    - by CaNNaDaRk
    I'm working with some friends on a browser based game where people can move on a 2D map. It's been almost 7 years and still people play this game so we are thinking of a way to give them something new. Since then the game map was a limited plane and people could move from (0, 0) to (MAX_X, MAX_Y) in quantized X and Y increments (just imagine it as a big chessboard). We believe it's time to give it another dimension so, just a couple of weeks ago, we began to wonder how the game could look with other mappings: Unlimited plane with continous movement: this could be a step forward but still i'm not convinced. Toroidal World (continous or quantized movement): sincerely I worked with torus before but this time I want something more... Spherical world with continous movement: this would be great! What we want Users browsers are given a list of coordinates like (latitude, longitude) for each object on the spherical surface map; browsers must then show this in user's screen rendering them inside a web element (canvas maybe? this is not a problem). When people click on the plane we convert the (mouseX, mouseY) to (lat, lng) and send it to the server which has to compute a route between current user's position to the clicked point. What we have We began writing a Java library with many useful maths to work with Rotation Matrices, Quaternions, Euler Angles, Translations, etc. We put it all together and created a program that generates sphere points, renders them and show them to the user inside a JPanel. We managed to catch clicks and translate them to spherical coords and to provide some other useful features like view rotation, scale, translation etc. What we have now is like a little (very little indeed) engine that simulates client and server interaction. Client side shows points on the screen and catches other interactions, server side renders the view and does other calculus like interpolating the route between current position and clicked point. Where is the problem? Obviously we want to have the shortest path to interpolate between the two route points. We use quaternions to interpolate between two points on the surface of the sphere and this seemed to work fine until i noticed that we weren't getting the shortest path on the sphere surface: We though the problem was that the route is calculated as the sum of two rotations about X and Y axis. So we changed the way we calculate the destination quaternion: We get the third angle (the first is latitude, the second is longitude, the third is the rotation about the vector which points toward our current position) which we called orientation. Now that we have the "orientation" angle we rotate Z axis and then use the result vector as the rotation axis for the destination quaternion (you can see the rotation axis in grey): What we got is the correct route (you can see it lays on a great circle), but we get to this ONLY if the starting route point is at latitude, longitude (0, 0) which means the starting vector is (sphereRadius, 0, 0). With the previous version (image 1) we don't get a good result even when startin point is 0, 0, so i think we're moving towards a solution, but the procedure we follow to get this route is a little "strange" maybe? In the following image you get a view of the problem we get when starting point is not (0, 0), as you can see starting point is not the (sphereRadius, 0, 0) vector, and as you can see the destination point (which is correctly drawn!) is not on the route. The magenta point (the one which lays on the route) is the route's ending point rotated about the center of the sphere of (-startLatitude, 0, -startLongitude). This means that if i calculate a rotation matrix and apply it to every point on the route maybe i'll get the real route, but I start to think that there's a better way to do this. Maybe I should try to get the plane through the center of the sphere and the route points, intersect it with the sphere and get the geodesic? But how? Sorry for being way too verbose and maybe for incorrect English but this thing is blowing my mind! EDIT: This code version is related to the first image: public void setRouteStart(double lat, double lng) { EulerAngles tmp = new EulerAngles ( Math.toRadians(lat), 0, -Math.toRadians(lng)); //set route start Quaternion qtStart.setInertialToObject(tmp); //do other stuff like drawing start point... } public void impostaDestinazione(double lat, double lng) { EulerAngles tmp = new AngoliEulero( Math.toRadians(lat), 0, -Math.toRadians(lng)); qtEnd.setInertialToObject(tmp); //do other stuff like drawing dest point... } public V3D interpolate(double totalTime, double t) { double _t = t/totalTime; Quaternion q = Quaternion.Slerp(qtStart, qtEnd, _t); RotationMatrix.inertialQuatToIObject(q); V3D p = matInt.inertialToObject(V3D.Xaxis.scale(sphereRadius)); //other stuff, like drawing point ... return p; } //mostly taken from a book! public static Quaternion Slerp(Quaternion q0, Quaternion q1, double t) { double cosO = q0.dot(q1); double q1w = q1.w; double q1x = q1.x; double q1y = q1.y; double q1z = q1.z; if (cosO < 0.0f) { q1w = -q1w; q1x = -q1x; q1y = -q1y; q1z = -q1z; cosO = -cosO; } double sinO = Math.sqrt(1.0f - cosO*cosO); double O = Math.atan2(sinO, cosO); double oneOverSinO = 1.0f / senoOmega; k0 = Math.sin((1.0f - t) * O) * oneOverSinO; k1 = Math.sin(t * O) * oneOverSinO; // Interpolate return new Quaternion( k0*q0.w + k1*q1w, k0*q0.x + k1*q1x, k0*q0.y + k1*q1y, k0*q0.z + k1*q1z ); } A little dump of what i get (again check image 1): Route info: Sphere radius and center: 200,000, (0.0, 0.0, 0.0) Route start: lat 0,000 °, lng 0,000 ° @v: (200,000, 0,000, 0,000), |v| = 200,000 Route end: lat 30,000 °, lng 30,000 ° @v: (150,000, 86,603, 100,000), |v| = 200,000 Qt dump: (w, x, y, z), rot. angle°, (x, y, z) rot. axis Qt start: (1,000, 0,000, -0,000, 0,000); 0,000 °; (1,000, 0,000, 0,000) Qt end: (0,933, 0,067, -0,250, 0,250); 42,181 °; (0,186, -0,695, 0,695) Route start: lat 30,000 °, lng 10,000 ° @v: (170,574, 30,077, 100,000), |v| = 200,000 Route end: lat 80,000 °, lng -50,000 ° @v: (22,324, -26,604, 196,962), |v| = 200,000 Qt dump: (w, x, y, z), rot. angle°, (x, y, z) rot. axis Qt start: (0,962, 0,023, -0,258, 0,084); 31,586 °; (0,083, -0,947, 0,309) Qt end: (0,694, -0,272, -0,583, -0,324); 92,062 °; (-0,377, -0,809, -0,450)

    Read the article

  • How to modify a xml file using PHP? use a node to retrieve the value of new child nodes and add them

    - by Avinash Sonee
    I have pasted the example of what I need here : http://pastie.org/1005178 I have a xml file with say the following info <state> <info> <name>hello</name> <zip>51678</zip> </info> <info> <name>world</name> <zip>54678</zip> </info> </state> Now I need to create a new xml file which has the following <state> <info> <name>hello</name> <zip>51678</zip> <lat>17.89</lat> <lon>78.90</lon> </info> <info> <name>world</name> <zip>54678</zip> <lat>16.89</lat> <lon>83.45</lon> </info> </state> So, basically I need to add lat and lon nodes to each info element. these lat and lon correspond to the zip code which are stored in a mysql file which contains 3 fields - pin, lat and lon How do i do this recursively. I have say 1000 info elements in a file Please give me a sample code because I have already tried using simplexml and read the documentation but doesn't see to understand it properly

    Read the article

  • how to extract information from JSON using jQuery

    - by Richard Reddy
    Hi, I have a JSON response that is formatted from my C# WebMethod using the JavascriptSerializer Class. I currently get the following JSON back from my query: {"d":"[{\"Lat\":\"51.85036\",\"Long\":\"-8.48901\"},{\"Lat\":\"51.89857\",\"Long\":\"-8.47229\"}]"} I'm having an issue with my code below that I'm hoping someone might be able to shed some light on. I can't seem to get at the information out of the values returned to me. Ideally I would like to be able to read in the Lat and Long values for each row returned to me. Below is what I currently have: $.ajax({ type: "POST", url: "page.aspx/LoadWayPoints", data: "{'args': '" + $('numJourneys').val() + "'}", contentType: "application/json; charset=utf-8", dataType: "json", success: function (msg) { if (msg.d != '[]') { var lat = ""; var long = ""; $.each(msg.d, function () { lat = this['MapLatPosition']; long = this['MapLongPosition']; }); alert('lat =' + lat + ', long =' + long); } } }); I think the issue is something to do with how the JSON is formatted but I might be incorrect. Any help would be great. Thanks, Rich

    Read the article

  • Start one functon after another finished iphone

    - by user295944
    I have a function that updates the gps coordinate lat and long then sends a tweet with the lat and long info attached. I want the function to wait until the lat and long are filled before the tweet goes through but it seems to do both at the same time so the lat and long don't get filled in. How do I make the gps location update first?

    Read the article

  • How to maintain decimal percision in calculations

    - by Blankman
    I need to sum 2 decimal values together, then divide by 2 and convert to string. My calculation currently is trimming to 2 decimal places, but I want to keep as many decimals as I can. city.Latitude = ( (lat.North + lat.South) / 2 ).ToString(); the values for lat.North and lat.Souch are like: 55.32342322

    Read the article

  • How to maintain decimal precision in calculations

    - by Blankman
    I need to sum 2 decimal values together, then divide by 2 and convert to string. My calculation currently is trimming to 2 decimal places, but I want to keep as many decimals as I can. city.Latitude = ( (lat.North + lat.South) / 2 ).ToString(); the values for lat.North and lat.Souch are like: 55.32342322

    Read the article

  • How to display an external content in my website using javascript

    - by Chris
    Hello! This is my first post! I have a question about javascript...here is my code: <html> <head> <title>Geolocation Demo</title> </head> <body> <h1>Geolocation Demo</h1> <p>Latitude: <span id="lat">0.00</span> Longitude: <span id="lon">0.00</span> City: <span id="city">Loading...</span></p> <p><a id="city_link" href="http://tinygeocoder.com/" target="_blank">View City</a></p> <p><a id="gmaps_link" href="http://maps.google.co.uk/" target="_blank">View on Google Maps</a></p> <script language="javascript"> // show the position on the page and make a google maps link function showPosition(position) { var lat = position.coords.latitude; var lon = position.coords.longitude; document.getElementById("lat").innerHTML = lat; document.getElementById("lon").innerHTML = lon; var gmaps_url = "http://maps.google.co.uk/maps?f=q&source=s_q&hl=en&geocode=&q=" + lat + "+" + lon; var city_url = "http://tinygeocoder.com/create-api.php?g=" + lat + "," + lon; document.getElementById("gmaps_link").href = gmaps_url; document.getElementById("city_link").href = city_url; } </script> </body> </html> As you can see, this script target my geolocation. Specifically, Lat and Lon are working perfectly. In addinition, i want to display and region info (like city). So, i found a website which i provide the coordinates and it returns me a region name. My question is if i can display the name of region without clicking the link "View city" but in the field "city"...is it possible to pass the webpage content (http://tinygeocoder.com/create-api.php?g=" + lat + "," + lon;) into my webpage? The content of this page is only the name as i said...no html tags! Thank you!

    Read the article

  • Access location variable in another process

    - by user295944
    I have a locationmanager in my main program which is called HomeViewController which I get the latitude and longitude and store them in LAT and LON. I can use LAT and LON in HomeViewController just fine. Once I go to another controller which is sending pictures and setting properties on flicker I want to use LAT and LON, how do I do this? I tried putting HomeViewController.LAT but obviously that does not work, I'm pretty new to the language so I am confused.

    Read the article

  • Convet long/lat to pixel x/y on a given picure.

    - by kalininew
    I have a city "map" (for example - Moscow). She in accuracy repeats the contours the given city in google maps (that is it is copied from google maps and it is a little processed, but the sense remained the same). Also I have object co-ordinates in a city (in co-ordinates of google). Problem: how to translate google co-ordinates to the co-ordinates of my picture (that is in pixels on OX and OY on a picture). That is I receive google-co-ordinates and it is necessary for me to draw this point on my picture. I know that on small scales (for example on city scales) it to make simply enough (it is necessary to learn what google-co-ordinates has one of picture corners, then to learn "price" of one pixel in google-co-ordinates on a picture on axes OX and OY separately). But on the big scales (country scale) "price" of one pixel will be not a constant, and will vary strongly enough and the method described above cannot be applied. How to solve a problem on country scales?

    Read the article

  • Providing lat/long AND title in iOS Maps URL seems to cause zoom level to be ignored

    - by Ian Howson
    I'm writing an iOS app that shows a location in Maps upon a user action. I'd like to drop a pin with a description and zoom in to show map detail. If I invoke Maps with the url http://maps.google.com/maps?q=-33.895851,151.18483+(Some+Description)&z=19 I get a pin with 'Some Description', but the zoom level is ignored. This does work on the Google Maps website. If I use http://maps.google.com/maps?q=-33.895851,151.18483&z=19 the zoom works, but I get no pin. I've tried a few combinations of ?q=, ?ll= and ?sll=, but so far, nothing will change zoom and show a description. Any clues? Just so we're really clear, here are some screenshots. I want this to work on a real device (i.e. with iOS Maps). The simulator uses Google Maps through Safari. Here's what I see with URL 1 ([[UIApplication sharedApplication] openURL:[NSURL URLWithString: @"http://maps.google.com/maps?q=-33.895851,151.18483+(Some+Description)&z=19"]];) This is URL 2 ([[UIApplication sharedApplication] openURL:[NSURL URLWithString: @"http://maps.google.com/maps?q=-33.895851,151.18483&z=19"]];): This is relikd's suggestion ([[UIApplication sharedApplication] openURL:[NSURL URLWithString: @"http://maps.google.com/maps?z=19&q=-33.895851,151.18483+(Some+Description)"]];): I want the image I see in screenshot 2, but with a pin and a description.

    Read the article

  • Convert long/lat to pixel x/y on a given picure.

    - by Kalinin
    I have a city "map" (for example - Moscow). She in accuracy repeats the contours the given city in google maps (that is it is copied from google maps and it is a little processed, but the sense remained the same). Also I have object co-ordinates in a city (in co-ordinates of google). Problem: how to convert google co-ordinates to the co-ordinates of my picture (that is in pixels on OX and OY on a picture). That is I receive google-co-ordinates and it is necessary for me to draw this point on my picture. The most desired variant of the answer - is based on javascript, but it is possible and on php. I know that on small scales (for example on city scales) it to make simply enough (it is necessary to learn what google-co-ordinates has one of picture corners, then to learn "price" of one pixel in google-co-ordinates on a picture on axes OX and OY separately). But on the big scales (country scale) "price" of one pixel will be not a constant, and will vary strongly enough and the method described above cannot be applied. How to solve a problem on country scales?

    Read the article

  • How to extract the lat/lng of pins in google maps?

    - by BCS
    I want to extract the latitude and longitude of a set of about 50-100 pins in a Google maps web page. I don't control the page and I don't need to do it more than once so I'm looking for something quick and dirty. I've got FireFox with FireBug as well as Chrome and all I need is something that's easier than re typing all the numbers.

    Read the article

  • How to get the Zoom Levels and Lat and Long values of the Map when Zoom in/out.

    - by ChandraSekhar
    I am implement an application based on the MapKit using iphone sdk.I just now a method to get the event when we drag, zoom in/out on the map. The method is as like this (void)mapView:(MKMapView *)mapView regionDidChangeAnimated:(BOOL)animated Now I need to get the following bullets. 1.TopLeft's and Bottom Right's Latitude and longitude values. 2.Center of the Map. 3.zoom level. Please give me suggessions to solve the above 3 use cases. Thanks in Advance, Sekhar Bethalam.

    Read the article

< Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >