Search Results

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

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

  • Fastest distance lookup given latitude/longitude?

    - by Ryan Detzel
    I currently have just under a million locations in a mysql database all with longitude and latitude information. With this I use another lat/lng to find the distance of certain places in the database but it's not as fast as I want it to be especially with 100+ hits a second. Is there a faster formula or possibly a faster system other than mysql for this? The formula I'm using is this. select name, ( 3959 * acos( cos( radians(42.290763) ) * cos( radians( locations.lat ) ) * cos( radians( locations.lng ) - radians(-71.35368) ) + sin( radians(42.290763) ) * sin( radians( locations.lat ) ) ) ) AS distance from locations where active = 1 HAVING distance < 10 ORDER BY distance;

    Read the article

  • Google Local Search API

    - by Gublooo
    hey guys couple of quick questions 1) In the local search results - we can get a lot of parameters like street title, address, city, state, lat, long , url etc - In order for me to uniquely identify this record - can I consider URL to be unique to this address or concatenation of latitude and longitude Ref: http://code.google.com/apis/ajaxsearch/documentation/reference.html#_class_GlocalResult 2) In terms of usage, depending upon what user enters, I'm displaying a list of local business for the user to choose. Now when a user selects a particular business address - is it legal for me to store that business address along with lat and longitude information in my database for future look ups. I've seen a lot of blogs talking about storing the lat/long info but just want to be sure that i'm not violating and google rules. Thanks

    Read the article

  • Passing parameters to web service method in c#

    - by wafa.cs1
    Hello I'm developing an android application .. which will send location data to a web service to store in the server database. In Java: I've used REST protocol so the URI is: HttpPost request = new HttpPost("http://trafficmapsa.com/GService.asmx/GPSdata? lon="+Lon+"&Lat="+Lat+"&speed="+speed); In Asp.net (c#) web service will be: [WebMethod] public CountryName GPSdata(Double Lon, Double Lat, Double speed) { after passing the data from android ..nothing return in back .. and there is no data in the database!! Is there any library missing in the CS file!! I cannot figure out what is the problem.

    Read the article

  • Markers in Google Maps Application

    - by Samuh
    I am supposed to display a certain location using Google Maps application. I have lat/long values and tried Intent.ACTION_VIEW with "geo:lat,long?z=15" uri. The Google Maps application loads centered on the supplied lat-long value but obviously does not display any marker(overlays) pin-pointing the location. Is it possible to request the Google Maps App to display markers? Also, the zoom level paramater doesnt seem to work. Maps load at the default zoom level of 10. I can easily achieve this using MapActivity but Google Map App is what is desired. Thanks

    Read the article

  • Filter zipcodes by proximity in Django with the Spherical Law of Cosines

    - by spiffytech
    I'm trying to handle proximity search for a basic store locater in Django. Rather than haul PostGIS around with my app just so I can use GeoDjango's distance filter, I'd like to use the Spherical Law of Cosines distance formula in a model query. I'd like all of the calculations to be done in the database in one query, for efficiency. An example MySQL query from The Internet implementing the Spherical Law of Cosines like this: SELECT id, ( 3959 * acos( cos( radians(37) ) * cos( radians( lat ) ) * cos( radians( lng ) - radians(-122) ) + sin( radians(37) ) * sin( radians( lat ) ) ) ) AS distance FROM stores HAVING distance < 25 ORDER BY distance LIMIT 0 , 20; The query needs to reference the Zipcode ForeignKey for each store's lat/lng values. How can I make all of this work in a Django model query?

    Read the article

  • Use the long reserved word as a variable name in C#

    - by Mark Pearl
    Hi... a bit of an unusual one.. but I was wondering if anyone knew how I could declare a reserved word as a variable. I have the following code, but it does not like my use of the long variable name. I know I could rename it, but for instrest sakes I would like to know if this is at all possible. private string lat; private string long; public string Lat { get { return lat; } } public string Long { get { return long; } }

    Read the article

  • Adding a computed column to an ActiveRecord query

    - by bmwbzz
    Hi, I am running a query using a scope and some conditions. Something like this: conditions[:offset] = (options[:page].to_i - 1) * PAGE_SIZE unless options[:page].blank? conditions[:limit] = options[:limit] ||= PAGE_SIZE scope = Promo.enabled.active results = scope.all conditions I'd like to add a computed column to the query (at the point when I'm now calling scope.all). Something like this: (ACOS(least(1,COS(0.71106459055501)*COS(-1.2915436464758)*COS(RADIANS(addresses.lat))*COS(RADIANS(addresses.lng))+ COS(0.71106459055501)*SIN(-1.2915436464758)*COS(RADIANS(addresses.lat))*SIN(RADIANS(addresses.lng))+ SIN(0.71106459055501)*SIN(RADIANS(addresses.lat))))*3963.19) as accurate_distance Is there a way to do that without just using find_by_sql and rewriting the whole existing query? Thanks!

    Read the article

  • google maps clicking inside a polygon

    - by amarsh-anand
    The following javascript snippet is supposed to do the following: As the user clicks on the map, initialize headMarker and draw a circle (polygon) around it As the user clicks inside the circle, initialize tailMarker and draw the path between these two markers 1 is happening as expected. But as the user clicks inside the circle, overlay is non-null while point is null in the function(overlay,point) . Can someone tell me a way out. GEvent.addListener(map, "click", function(overlay,point) { if (isCreateHeadPoint) { // add the head marker headMarker = new GMarker(point,{icon:redIcon,title:'0'}); map.addOverlay(headMarker); isCreateHeadPoint = false; // draw the circle drawMapCircle(point.lat(),point.lng(),1,'#cc0000',2,0.8,'#0',0.1); } else { // add the tail marker tailMarker = new GMarker(point,{icon:greenIcon,title:''}); map.addOverlay(tailMarker); isCreateHeadPoint = true; // load thes path from head to tail direction.load("from:" + headMarker.getPoint().lat()+ ", " + headMarker.getPoint().lng()+ " to:" + tailMarker.getPoint().lat() + "," + tailMarker.getPoint().lng(), {getPolyline:true}); } });

    Read the article

  • gMaps suddenly stopped working : Can't find variable: G_NORMAL_MAP

    - by Luca
    hello! i inject a map on my div called "concessionario-map" with GMap, a jquery plugin. Gmap everything works fine until this morning. now the debugger says: ReferenceError: Can't find variable: G_NORMAL_MAP i just search on google and i read some similar situation, but i dont find a case like mine. please, can you help me? thanks a lot in advance :) (full code) $.getJSON("http://maps.google.com/maps/geo?q="+loc+"&key=ABQIAAAAgDXoBEgIn38xaRBBqo6ygxTDjF32IQ1zA0BVcGSuGouGRvo0kRRKiyipbCniJWSso2scatdz36K-Mg&sensor=false&output=json&callback=?",function(data, textStatus) { long = data.Placemark[0].Point.coordinates[0]; lat = data.Placemark[0].Point.coordinates[1]; console.log(data); $('#concessionario-map').gMap( { scrollwheel: false, latitude: lat, longitude: long, zoom: 15, markers: [{ latitude: lat, longitude: long }], icon: { image: "files/images/gmap_pin_orange.png", shadow: "files/images/gmap_pin_orange_shadow.png", iconsize: [26, 46], shadowsize: [28, 48], iconanchor: [12,46], infowindowanchor: [12, 0] } }) });

    Read the article

  • Google Maps setCenter() problem

    - by hotcoder
    I'm using google maps. In my code i've used setCenter() function. My problem is that marker is always located on top left corner of map area (not at the center). Please tell me how to resolve it? My piece of code is lat = 46.437857; lon = -113.466797; marker = new GMarker(new GLatLng(lat, lon)); var topRight = new GControlPosition(G_ANCHOR_TOP_RIGHT, new GSize(20, 40)); map.addControl(new GLargeMapControl3D(), topRight); map.setCenter(new GLatLng(lat, lon), 5); map.addOverlay(marker);

    Read the article

  • Remove polyline

    - by Fran Rod
    I have the next code which show a path using a polyline. How can I remove it? downloadUrl("myfile.asp", function(data) { var xml = xmlParse(data); var markers = xml.documentElement.getElementsByTagName("marker"); var path = []; for (var i = 0; i < markers.length; i++) { var lat = parseFloat(markers[i].getAttribute("lat")); var lng = parseFloat(markers[i].getAttribute("lng")); var point = new google.maps.LatLng(lat,lng); path.push(point); }//finish loop var polyline = new google.maps.Polyline({ path: path, strokeColor: "#FF0000", strokeOpacity: 1.0, strokeWeight: 2 }); polyline.setMap(map); }); //end download url I have tried it using the next function but I m not able to make it work. function removePath() { polyline.setMap(null) }

    Read the article

  • Table alias -- Unkown column in field list

    - by Jason
    Hi all, I have a sql query which is executing a LEFT JOIN on 2 tables in which some of the columns are ambiguous. I can prefix the joined tables but when I try to prefix one of the columns from the table in the FROM clause, it tells me Unknown column. I even tried giving that table an alias like so ...From points AS p and using "p" to prefix the tables but that didn't work either. Can someone tell me what I'm doing wrong. Here is my query: SELECT point_title, point_url, address, city, state, zip_code, phone, `points`.`lat`, `points`.`longi`, featured, kmlno, image_url, category.title, category_id, point_id, lat, longi, reviews.star_points, reviews.review_id, count(reviews.point_id) as totals FROM (SELECT *, ( 3959 * acos( cos( radians('37.7717185') ) * cos( radians( lat ) ) * cos( radians( longi ) - radians('-122.4438929') ) + sin( radians('37.7717185') ) * sin( radians( lat ) ) ) ) AS distance FROM points HAVING distance < '25') as distResults LEFT JOIN category USING ( category_id ) LEFT JOIN reviews USING ( point_id ) WHERE (point_title LIKE '%Playgrounds%' OR category.title LIKE '%Playgrounds%') GROUP BY point_id ORDER BY totals DESC, distance LIMIT 0 , 10

    Read the article

  • Android - How to launch Google map intent in android app with certain location, zoom level and marker

    - by umirza47
    Map Intent not working with specific zoom level as well as custom marker float lat = 40.714728f; float lng = -73.998672f; String maplLabel = "ABC Label"; final Intent intent = new Intent(android.content.Intent.ACTION_VIEW, Uri.parse("geo:0,0?q="+lat+","+lng+"&z=16 (" + maplLabel + ")")); startActivity(intent); Anybody know what is wrong? or how to do so? I want to show map of certain (lat,lng) with a custom label-marker at a specific zoom level.

    Read the article

  • Adding Value into an Input Field

    - by McCrum
    Hey, I am working on an iPhone Web App using HTML & CSS. I have currently got the JavaScript/HTML5 Geolocation picking up my current location and showing me it on a Google Map using Lat & Long values. I also want to add these Lat & Long Values into the 'address' text field on the page so I can submit the details. Here is the link: http://m.belfi.co.uk/form.html When I click 'find me' I would like the lat and long to be added to the 'address' input field. Have no idea how to do this though :(

    Read the article

  • How to order by results from 2 seperate tables in PHP and MySQL.

    - by Vafello
    I am trying to output results of 2 sql queries to one JSON file. The problem is that I would like to order them ascending by distance which is the result of equation that takes homelat and homelon from the users table and lat, lng from locations table.(basically it takes lattitude and longitude of one point and another and computes the distance between these points). Is it possible to take some parameters from both select queries, compute it and output the result in ascending order? $wynik = mysql_query("SELECT homelat, homelon FROM users WHERE guid='2'") or die(mysql_error()); ; $query = "SELECT * FROM locations WHERE timestamp"; $result = map_query($query); $points = array(); while ($aaa = mysql_fetch_assoc($wynik)) { while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) { array_push($points, array('name'=>$row['name'], 'lat'=>$row['lat'], 'lng'=>$row['lng'], 'description'=>$row['description'], 'eventType'=>$row['eventType'], 'date'=>$row['date'], 'isotime'=>date('c', ($row['timestamp'])), 'homelat'=>$aaa['homelat'], 'homelon'=>$aaa['homelon'])); } echo json_encode(array("Locations"=>$points));

    Read the article

  • AppEngine GeoPt Data Upload

    - by Eric Landry
    I'm writing a GAE app in Java and only using Python for the data upload. I'm trying to import a CSV file that looks like this: POSTAL_CODE_ID,PostalCode,City,Province,ProvinceCode,CityType,Latitude,Longitude 1,A0E2Z0,Monkstown,Newfoundland,NL,D,47.150300000000001,-55.299500000000002 I was able to import this file in my datastore if I import Latitude and Longitude as floats, but I'm having trouble figuring out how to import lat and lng as a GeoPt. Here is my loader.py file: import datetime from google.appengine.ext import db from google.appengine.tools import bulkloader class PostalCode(db.Model): id = db.IntegerProperty() postal_code = db.PostalAddressProperty() city = db.StringProperty() province = db.StringProperty() province_code = db.StringProperty() city_type = db.StringProperty() lat = db.FloatProperty() lng = db.FloatProperty() class PostalCodeLoader(bulkloader.Loader): def __init__(self): bulkloader.Loader.__init__(self, 'PostalCode', [('id', int), ('postal_code', str), ('city', str), ('province', str), ('province_code', str), ('city_type', str), ('lat', float), ('lng', float) ]) loaders = [PostalCodeLoader] I think that the two db.FloatProperty() lines should be replaced with a db.GeoPtProperty(), but that's where my trail ends. I'm very new to Python so any help would be greatly appreciated.

    Read the article

  • C# Random of cordinates is linear

    - by Shawn Mclean
    My code is to generate random cordinates of lat and long within a bound: Random lastLat = new Random(); Random lastLon = new Random(); for (int i = 0; i < 50; i++) { int lat = lastLat.Next(516400146, 630304598); //18.51640014679267 - 18.630304598192915 int lon = lastLon.Next(224464416, 341194152); //-72.34119415283203 - -72.2244644165039 SamplePostData d0 = new SamplePostData(); d0.Location = new Location(Convert.ToDouble("18." + lat), Convert.ToDouble("-72." + lon)); AddPushpin(d0); } My output looks like this: Is there something wrong with how my numbers are generated?

    Read the article

  • Data storage advice needed: Best way to store location + time data?

    - by sobedai
    I have a project in mind that will require the majority of queries to be keyed off of lat/long as well as date + time. Initially, I was thinking of a standard RDBMS where lat, long, and the datetime field are properly indexed. Then, I began thinking of a document based system where the document was essentially a timestamp and each document has lat/long with in it. Each document could have n objects associated with it. I'm looking for advice on what would be the best type of storage engine for this sort of thing is - which of the above idea would be better or if there is something else completely that is the ideal solution. Thanks

    Read the article

  • How to check if Google Street View available and display message?

    - by Vafello
    I am passing lat and lng variables and display google sreet view in a div. The problem is that when the StreetView is unavilable then nothing is displayed. I would like to check if there is a streetview for a given lat and lng and display a message. Here is my code: var myPano = new GStreetviewPanorama(document.getElementById("street2"), panoOpts); var location = new GLatLng(lat,lng) myPano.setLocationAndPOV(location); Maybe I should use something like: Event.addListener(myPano, "error", errorMessage()); Any ideas?

    Read the article

  • Android-Java: Constructing a triangle based on Coordinates on a map and your bearing

    - by Aidan
    Hi Guys, I'm constructing a geolocation based application and I'm trying to figure out a way to make my application realise when a user is facing the direction of the given location (a particular long / lat co-ord). I've got the math figured, I just have the triangle to construct. //UPDATE So I've figured out a good bit of this... Below is a method which takes in a long / lat value and attempts to compute a triangle finding a point 700 meters away and one to its left + right. It'd then use these to construct the triangle. It computes the correct longitude but the latitude ends up somewhere off the coast of east Africa. (I'm in Ireland!). public void drawtri(double currlng,double currlat, double bearing){ bearing = (bearing < 0 ? -bearing : bearing); System.out.println("RUNNING THE DRAW TRIANGLE METHOD!!!!!"); System.out.println("CURRENT LNG" + currlng); System.out.println("CURRENT LAT" + currlat); System.out.println("CURRENT BEARING" + bearing); //Find point X(x,y) double distance = 0.7; //700 meters. double R = 6371.0; //The radius of the earth. //Finding X's y value. Math.toRadians(currlng); Math.toRadians(currlat); Math.toRadians(bearing); distance = distance/R; Global.Alat = Math.asin(Math.sin(currlat)*Math.cos(distance)+ Math.cos(currlat)*Math.sin(distance)*Math.cos(bearing)); System.out.println("CURRENT ALAT!!: " + Global.Alat); //Finding X's x value. Global.Alng = currlng + Math.atan2(Math.sin(bearing)*Math.sin(distance) *Math.cos(currlat), Math.cos(distance)-Math.sin(currlat)*Math.sin(Global.Alat)); Math.toDegrees(Global.Alat); Math.toDegrees(Global.Alng); //Co-ord of Point B(x,y) // Note: Lng = X axis, Lat = Y axis. Global.Blat = Global.Alat+ 00.007931; Global.Blng = Global.Alng; //Co-ord of Point C(x,y) Global.Clat = Global.Alat - 00.007931; Global.Clng = Global.Alng; } From debugging I've determined the problem lies with the computation of the latitude done here.. Global.Alat = Math.asin(Math.sin(currlat)*Math.cos(distance)+ Math.cos(currlat)*Math.sin(distance)*Math.cos(bearing)); I have no idea why though and don't know how to fix it. I got the formula from this site.. http://www.movable-type.co.uk/scripts/latlong.html It appears correct and I've tested multiple things... I've tried converting to Radians then post computations back to degrees, etc. etc. Anyone got any ideas how to fix this method so that it will map the triangle ONLY 700 meters in from my current location in the direction that I am facing? Thanks, EDIT/// Converting the outcome to radians gives me a lat of 5.6xxxxxxxxxxxxxx .I have a feeling this bug has something to do with conversions but its not THAT simple. The equation is correct, it just.. outputs wrong..

    Read the article

  • Replacing GTileLayer in Google Maps v3, with ImageMapType, Tile bounding box?

    - by justdev
    I need to update this code: radar_layer.getTileUrl=function(tile,zoom) { var llp = new GPoint(tile.x*256,(tile.y+1)*256); var urp = new GPoint((tile.x+1)*256,tile.y*256); var ll = G_NORMAL_MAP.getProjection().fromPixelToLatLng(llp,zoom); var ur = G_NORMAL_MAP.getProjection().fromPixelToLatLng(urp,zoom); var dt = new Date(); var nowtime = dt.getTime(); var tileurl = "http://demo.remoteservice.com/cgi-bin/serve.cgi?"; tileurl+="bbox="+ll.lng()+","+ll.lat()+","+ur.lng()+","+ur.lat(); tileurl+="&width=256&height=256&reaspect=false&cachetime="+nowtime; return tileurl; }; I got as far as: var DemoLayer = new google.maps.ImageMapType({ getTileUrl: function(coord, zoom) { var llp = new google.maps.Point(coord.x*256,(coord.y+1)*256); var urp = new google.maps.Point((coord.x+1)*256,coord.y*256); var ll = googleMap.getProjection().fromPointToLatLng(llp); var ur = googleMap.getProjection().fromPointToLatLng(urp); var dt = new Date(); var nowtime = dt.getTime(); var tileurl = "http://demo.remoteservice.com/cgi-bin/serve.cgi?"; tileurl+="bbox="+ll.lng()+","+ll.lat()+","+ur.lng()+","+ur.lat(); tileurl+="&width=256&height=256&reaspect=false&cachetime="+nowtime; return tileurl; }, tileSize: new google.maps.Size(256, 256), opacity:1.0, isPng: true }); Specifically, I need help with this section: var llp = new google.maps.Point(coord.x*256,(coord.y+1)*256); var urp = new google.maps.Point((coord.x+1)*256,coord.y*256); var ll = googleMap.getProjection().fromPointToLatLng(llp); var ur = googleMap.getProjection().fromPointToLatLng(urp); The service wants the tile bounding box from what I understand. However, ll and ur do not seem to correct at all. I had it working and displaying the entire map bounding box in each tile, but of course that's not what I need. Any insight here would be greatly appreciated, not having the GTileLayers in V3 is fine if I can work around it, until then I'm frustrated.

    Read the article

  • Sort latitude and longitude coordinates into clockwise ordered quadrilateral

    - by Dave Jarvis
    Problem Users can provide up to four latitude and longitude coordinates, in any order. They do so with Google Maps. Using Google's Polygon API (v3), the coordinates they select should highlight the selected area between the four coordinates. Solutions and Searches http://www.geocodezip.com/map-markers_ConvexHull_Polygon.asp http://softsurfer.com/Archive/algorithm_0103/algorithm_0103.htm http://stackoverflow.com/questions/2374708/how-to-sort-points-in-a-google-maps-polygon-so-that-lines-do-not-cross http://stackoverflow.com/questions/242404/sort-four-points-in-clockwise-order http://en.literateprograms.org/Quickhull_%28Javascript%29 Graham's scan seems too complicated for four coordinates Sort the coordinates into two arrays (one by latitude, the other longitude) ... then? Jarvis March algorithm? Question How do you sort the coordinates in (counter-)clockwise order, using JavaScript? Code Here is what I have so far: // Ensures the markers are sorted: NW, NE, SE, SW function sortMarkers() { var ns = markers.slice( 0 ); var ew = markers.slice( 0 ); ew.sort( function( a, b ) { if( a.position.lat() < b.position.lat() ) { return -1; } else if( a.position.lat() > b.position.lat() ) { return 1; } return 0; }); ns.sort( function( a, b ) { if( a.position.lng() < b.position.lng() ) { return -1; } else if( a.position.lng() > b.position.lng() ) { return 1; } return 0; }); var nw; var ne; var se; var sw; if( ew.indexOf( ns[0] ) > 1 ) { nw = ns[0]; } else { ne = ns[0]; } if( ew.indexOf( ns[1] ) > 1 ) { nw = ns[1]; } else { ne = ns[1]; } if( ew.indexOf( ns[2] ) > 1 ) { sw = ns[2]; } else { se = ns[2]; } if( ew.indexOf( ns[3] ) > 1 ) { sw = ns[3]; } else { se = ns[3]; } markers[0] = nw; markers[1] = ne; markers[2] = se; markers[3] = sw; } What is a better approach? The recursive Convex Hull algorithm is overkill for four points in the data set. Thank you.

    Read the article

  • Geocoder error when using getFromLocation

    - by Ally
    I'm trying to get the current address based on long/lat. I have the following: Geocoder geocoder = new Geocoder(this); List<Address> addresses = geocoder.getFromLocation(lat, lng, 1); However, I get an error: no feature in GLocation I don't believe this is a permission problem.

    Read the article

  • Reverse geocoding with Google Maps API

    - by user296516
    I have found this code for reverse geocoding: var point = new GLatLng (lat[1],long[1]); var geocoder = new GClientGeocoder(); geocoder.getLocations (point, function(result) { alert (lat[1]+' '+long[1]+' '+result.address); }); But it pops the alert, saying that result.address is 'undefined'. Any ideas, what could be the problem?

    Read the article

  • How do I mock an object in this case? no obvious way to replace object with mock

    - by Tristan
    Hi there, Suppose I have this very simple method in Store's model: def geocode_address loc = Store.geocode(address) self.lat = loc.lat self.lng = loc.lng end If I want to write some test scripts that aren't affected by the geocoding service, which may be down, have limitations or depend on my internet connection, how do I mock out the geocoding service? If I could pass a geocoding object into the method, it would be easy, but I don't see how I could do it in this case. Thanks! Tristan

    Read the article

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