Search Results

Search found 77 results on 4 pages for 'googlemaps'.

Page 2/4 | < Previous Page | 1 2 3 4  | Next Page >

  • Common Mercator Projection formulas for Google Maps not working correctly

    - by Tom Halladay
    I am building a Tile Overlay server for Google maps in C#, and have found a few different code examples for calculating Y from Latitude. After getting them to work in general, I started to notice certain cases where the overlays were not lining up properly. To test this, I made a test harness to compare Google Map's Mercator LatToY conversion against the formulas I found online. As you can see below, they do not match in certain cases. Case #1 Zoomed Out: The problem is most evident when zoomed out. Up close, the problem is barely visible. Case #2 Point Proximity to Top & Bottom of viewing bounds: The problem is worse in the middle of the viewing bounds, and gets better towards the edges. This behavior can negate the behavior of Case #1 The Test: I created a google maps page to display red lines using the Google Map API's built in Mercator conversion, and overlay this with an image using the reference code for doing Mercator conversion. These conversions are represented as black lines. Compare the difference. The Results: Check out the top-most and bottom-most lines: The problem gets visually larger but numerically smaller as you zoom in: And it all but disappears at closer zoom levels, regardless of screen orientation. The Code: Google Maps Client Side Code: var lat = 0; for (lat = -80; lat <= 80; lat += 5) { map.addOverlay(new GPolyline([new GLatLng(lat, -180), new GLatLng(lat, 0)], "#FF0033", 2)); map.addOverlay(new GPolyline([new GLatLng(lat, 0), new GLatLng(lat, 180)], "#FF0033", 2)); } Server Side Code: Tile Cutter : http://mapki.com/wiki/Tile_Cutter OpenStreetMap Wiki : http://wiki.openstreetmap.org/wiki/Mercator protected override void ImageOverlay_ComposeImage(ref Bitmap ZipCodeBitMap) { Graphics LinesGraphic = Graphics.FromImage(ZipCodeBitMap); Int32 MapWidth = Convert.ToInt32(Math.Pow(2, zoom) * 255); Point Offset = Cartographer.Mercator2.toZoomedPixelCoords(North, West, zoom); TrimPoint(ref Offset, MapWidth); for (Double lat = -80; lat <= 80; lat += 5) { Point StartPoint = Cartographer.Mercator2.toZoomedPixelCoords(lat, -179, zoom); Point EndPoint = Cartographer.Mercator2.toZoomedPixelCoords(lat, -1, zoom); TrimPoint(ref StartPoint, MapWidth); TrimPoint(ref EndPoint, MapWidth); StartPoint.X = StartPoint.X - Offset.X; EndPoint.X = EndPoint.X - Offset.X; StartPoint.Y = StartPoint.Y - Offset.Y; EndPoint.Y = EndPoint.Y - Offset.Y; LinesGraphic.DrawLine(new Pen(Color.Black, 2), StartPoint.X, StartPoint.Y, EndPoint.X, EndPoint.Y); LinesGraphic.DrawString( lat.ToString(), new Font("Verdana", 10), new SolidBrush(Color.Black), new Point( Convert.ToInt32((width / 3.0) * 2.0), StartPoint.Y)); } } protected void TrimPoint(ref Point point, Int32 MapWidth) { point.X = Math.Max(point.X, 0); point.X = Math.Min(point.X, MapWidth - 1); point.Y = Math.Max(point.Y, 0); point.Y = Math.Min(point.Y, MapWidth - 1); } So, Anyone ever experienced this? Dare I ask, resolved this? Or simply have a better C# implementation of Mercator Project coordinate conversion? Thanks!

    Read the article

  • Google Maps inside custom PODS page

    - by Sharath
    I have a custom pods page called addstory.php which uses a public form to display some input fields. For one of the fields, i have a input helper that displays a google map location which I can use to pick out a location which is stored in comma separated variable. Here is the input helper code... <div class="form pick <?php echo $location; ?>"> <div id="map" style="width:500; height:500"> </div> <script type="text/javascript"> $(function() { map=new GMap(document.getElementById("map")); map.centerAndZoom(new GPoint(77.595062,13.043359),6); map.setUIToDefault(); GEvent.addListener(map,"click",function(overlay,latlng) { map.clearOverlays(); var marker = new GMarker(latlng); map.addOverlay(marker); //Extra stuff here.. } ); }); </script> </div> And this is the code inside my addstory.php <?php get_header(); $rw = new Pod('rainwater'); $fields=array( 'name', 'email', 'location'=>array('input_helper'=>'gmap_location'), ); echo $rw->publicForm($fields); ?> I get the following error...and the google map doesn't load. a is null error source line: [Break on this error] function Qd(a){for(var b;b=a.firstChild;){Rg(b);a.removeChild(b)}}

    Read the article

  • Adding ID's to google map markers

    - by Nick
    I have a script that loops and adds markers one at a time. I am trying to get the current marker to have an info window and and only have 5 markers on a map at a time (4 without info windows and 1 with) How would i add an id to each marker so that i can delete and close info windows as needed. this is the function i am using to set the marker function codeAddress(address, contentString) { var infowindow = new google.maps.InfoWindow({ content: contentString }); if (geocoder) { geocoder.geocode( { 'address': address}, function(results, status) { if (status == google.maps.GeocoderStatus.OK) { map.setCenter(results[0].geometry.location); var marker = new google.maps.Marker({ map: map, position: results[0].geometry.location }); infowindow.open(map,marker); } else { alert("Geocode was not successful for the following reason: " + status); } }); } }

    Read the article

  • Question about tracking user in a map application using cellid

    - by subh
    I am trying to understand the concept of cellid (http://www.opencellid.org/api) As per that, if we send a request http://www.opencellid.org/cell/get?key=myapikey&mnc=1&mcc=2&lac=200&cellid=234 it will respond with the latitude and longitude. I was wondering if this can be used from within a google map application for tracking a user or it needs to be used from within a mobile device? If it can be used from within a web app, what parameters should it use for mcc: mobile country code (decimal) mnc: mobile network code (decimal) lac: locale area code (decimal) cellid: value of the cell id E.g., will it work if we know the cell number of the person(e.g., 281 222 6700)

    Read the article

  • google maps call within a For Loop not returning distance

    - by Richard Reddy
    Hi, I am calling google maps within a for loop in my javascript as I have mulitple routes that need to be costed separately based on distances. Everything works great except that the distance is only returned for one of the routes. I have a feeling that it is something to do with the way I have the items declared within the ajax call for the maps. Any ideas what could be the issue from the code below? for (var i = 1; i <= numJourneys; i++) { var mapContainer = 'directionsMap' + i; var directionContainer = $('#getDistance' + i); $.ajax({ async: false, type: "POST", url: "Journey/LoadWayPoints", data: "{'args': '" + i + "'}", contentType: "application/json; charset=utf-8", dataType: "json", success: function (msg) { if (msg.d != '[]') { var map = new GMap2(document.getElementById(mapContainer)); var distance = directionContainer; var wp = new Array(); //routes var counter = 0; $.each(content, function () { wp[counter] = new GLatLng(this['Lat'], this['Long']); counter = counter + 1; }); map.clearOverlays(); map.setCenter(wp[0], 14); // load directions directions = new GDirections(map); GEvent.addListener(directions, "load", function () { alert(directions.getDistance()); //directionContainer.html(directions.getDistance().html); }); directions.loadFromWaypoints(wp, { getSteps: true }); } } }); }

    Read the article

  • Google map - How to escape charaters in the title of a marker in a google map?

    - by Anthony
    Say have this piece of code: var marker = new google.maps.Marker({ position: location, title: 'B&#250;fals', map: map }); This creates a marker as expected but if I hover the mouse over it I don’t see 'Búfals' as I would expect (instead I see the html code). This doesn't make any difference: var marker = new google.maps.Marker({ position: location, title: unescape('B&#250;fals'), map: map }); Any ideas? Thanks.

    Read the article

  • Google Maps rendering locally but not in live environment

    - by marcusstarnes
    I have a page that renders a simple google map for a specified location. This map renders without any problems at all when I run it locally on localhost, however, when I deploy this code to our live web servers (using our LIVE google API key for the appropriate domain) it fails to render, and upon putting a series of alerts within the javascript on the page, it appears that the 'Initialize' method (which should be called within body onLoad) is not being called. When I view the HTML source that is rendered on the live server it appears exactly as per the local version of the site (including the call to initialize() within the body onLoad event), albeit with the different maps API key. I have output the host (alert(window.location.host);) to ensure that the key I generated via the google maps api site, corresponds exactly to the live server, which it does. Does anyone have any ideas why it would be working locally but not when deployed to the live servers? The live site is hosted on 2 load-balanced web servers. This is the javascript that is rendered: <script src="http://maps.google.com/maps?file=api&amp;v=2&amp;sensor=false&amp;key=ABQIAAAA-BU8POZj19wRlTaKIXVM9xTz76xxk4yAELG9u79oXrhnLTB5NRRvAZ-bkKn1x8J68nfRTVOIWNPJEA" type="text/javascript"></script> <script type="text/javascript"> var map; var geocoder; alert(window.location.host); function initialize() { if (GBrowserIsCompatible()) { map = new GMap2(document.getElementById("businessMap")); map.setUIToDefault(); geocoder = new GClientGeocoder(); showAddress('St Margarets Street SW1P 3 London'); } } function showAddress(address) { geocoder.getLatLng( address, function(point) { if (!point) { // Address could not be located. jQuery('#googleMap').hide(); } else { map.setCenter(point, 13); var marker = new GMarker(point); map.addOverlay(marker); var html = 'Address info for the marker'; marker.openInfoWindow(html); GEvent.addListener(marker, "click", function() { marker.openInfoWindowHtml(html); }); } } ); } </script> Any help would be much appreciated. Thanks.

    Read the article

  • Multiple marker icons, how to add to google mashup

    - by user351189
    I have created a Google maps mashup, where with a bit of input, I have managed to have a sidebar that links to a video icon/marker that then opens up an info window showing virtual tours. I would, however, like to put different coloured marker icons on the map depending on the category that the video is in. This would be easy enough to do, but my page is made up of a mixture of J-Query and JavaScript all calling to the individual flash files. Could someone help me with the code for adding extra marker icons for different categories? Here is the code: So, after the intial 'var camera;' point, there comes this: function addMarker(point, title, video, details) { var marker = new GMarker(point, {title: title, icon:camera}); GEvent.addListener(marker, "click", function() { if (details) { marker.openInfoWindowTabsHtml([new GInfoWindowTab("Video", video), new GInfoWindowTab("More", details)]); } else { marker.openInfoWindowHtml(video); } }); Then further down, is the code for calling the individual marker image. I would like to add another image to this list - would I start out by calling the new object 'camera-red.image' or something similar? function initialize() { if (GBrowserIsCompatible()) { map = new GMap2(document.getElementById("mapDiv")); map.setCenter(new GLatLng(51.52484592590448, -0.13345599174499512), 17); map.setUIToDefault(); var uclvtSatMapType = createUclVTSatMapType() map.addMapType(uclvtSatMapType); map.setMapType(uclvtSatMapType); camera = new GIcon(G_DEFAULT_ICON); camera.image = "ucl-video.png"; camera.iconSize = new GSize(32,37); camera.iconAnchor = new GPoint(16,35); camera.infoWindowAnchor = new GPoint(16,2); addMarkersToMap(); } The actual map can be found here: link text Thanks.

    Read the article

  • How can CSS stop Google Maps loading?

    - by AP257
    I have a page with a Google Maps div: <div id="map_canvas" style="width: 100%; height: 332px;" ></div> If I comment out my CSS, the map loads fine: if I include the CSS, the map controls load, but the map tiles don't load: there's just a grey background. This is the case even if I put the map div just after the <body> tag, not within any styled element at all. No CSS, it loads fine. With CSS, no map. Does anyone know what could be causing this? I don't quite understand what the problem can be if no CSS styles are being applied to any element that contains the map. If more diagnostics are needed, please let me know, and I'll deploy the broken map onto a staging site, so people can look at the source.

    Read the article

  • Google maps and J-Query: Individual markers?

    - by user351189
    Hi there, I have created a Google maps mashup, where with a bit of input, I have managed to have a sidebar that links to a video icon/marker that then opens up an info window showing virtual tours. I would, however, like to put different coloured marker icons on the map depending on the category that the video is in. This would be easy enough to do, but my page is made up of a mixture of J-Query and JavaScript all calling to the individual flash files. Could someone help me with the code for adding extra marker icons for different categories? Here is the code: So, after the intial 'var camera;' point, there comes this: function addMarker(point, title, video, details) { var marker = new GMarker(point, {title: title, icon:camera}); GEvent.addListener(marker, "click", function() { if (details) { marker.openInfoWindowTabsHtml([new GInfoWindowTab("Video", video), new GInfoWindowTab("More", details)]); } else { marker.openInfoWindowHtml(video); } }); Then further down, is the code for calling the individual marker image. I would like to add another image to this list - would I start out by calling the new object 'camera-red.image' or something similar? function initialize() { if (GBrowserIsCompatible()) { map = new GMap2(document.getElementById("mapDiv")); map.setCenter(new GLatLng(51.52484592590448, -0.13345599174499512), 17); map.setUIToDefault(); var uclvtSatMapType = createUclVTSatMapType() map.addMapType(uclvtSatMapType); map.setMapType(uclvtSatMapType); camera = new GIcon(G_DEFAULT_ICON); camera.image = "ucl-video.png"; camera.iconSize = new GSize(32,37); camera.iconAnchor = new GPoint(16,35); camera.infoWindowAnchor = new GPoint(16,2); addMarkersToMap(); } The actual map can be found here: link text Thanks. Gray

    Read the article

  • Google Maps + PODSCMS

    - by Sharath
    Hi, I have a column called 'location' in a POD which I have created. I was looking to write a input helper where I display a Google Map and the user clicks on a location, and I capture that into this column. This is what I am trying to do <div class="form pick <?php echo $location; ?>"> <script src="http://maps.google.com/maps?file=api&v=1&key=<key_here>" type="text/javascript"></script> <div id="map" style="width:500; height:500"> <script type="text/javascript"> map=new GMap(document.getElementById("map")); map.centerAndZoom(new GPoint(77.595062,13.043359),6); map.setUIToDefault(); </script> </div> </div> But I am getting a number of errors from google maps API. Any idea how i can get this helper in there?

    Read the article

  • Google Maps zoom level in iphone objective c

    - by BibiBuBu
    Good Day! I am working on the google maps integration in iphone (objective C). i am calculating zoom level dynamically so that two map points fits the iphone screen. it is good for locations very far, but i have issue that if two locations are very near to each other the zoom level then the images go blank and does not show anything other than blurred image, which i dont want. i want that if location are very near then there should be some default level zoom that should be called or fitted in, so that images wont blur.

    Read the article

  • Building Outline Data in Google Maps (Android)

    - by scotty.hoag
    I'm working on an Android project that focuses on knowing how close you are to buildings. I wanted to know if there is some way to extract the geographic information about the outlines of buildings out of the Google Maps API. Thanks. EDIT: The functionality I'm looking for is similar to what's going on in this app. (Click the link near the top of the page that says "View Live Sample".) http://resources.esri.com/help/9.3/arcgisserver/apis/javascript/gmaps/help/google_start.htm#topics/samples/identify_features.html

    Read the article

  • iphone google maps - direction using latitude and longitude

    - by satyam
    I'm working on iphone app. I know my current location (latitude and longitude) and destination's (latitude and longitude). How can I use "Google maps" to find the directions. URL for google maps is something like "http://maps.google.com/maps?daddr=San+Francisco,+CA&saddr=cupertino" From above URL, inspite of source and destination places i want to use latitude and longitude. how?

    Read the article

  • Adding property:value pairs from GooglemapsAPI to an existing json/javascript object

    - by Rockinelle
    I am trying to create a script that finds the closest store/location to a customer using googlemapsAPI. So I've got a json object which is a collection of store objects. Using Jquery's .each to iterate through that object, I am grabbing the driving time from the customer to each store. If it finds the directions, It copies the duration of the drive which is an object with the time in seconds and a human readable value. That appears to work, however when I try to sort through all of those store objects with the drivetime added, I cannot read the object copied from google. If I console.log the whole object, 'closest_store', It shows the values I'm looking for. When I try to read the values directly via closest_store.driveTime, Firebug is outputting undefined in the console. What am I missing here? $.getJSON('<?php echo Url::base() ?>oldservices/get_locations', {}, function(data){ $.each(data, function(index, value) { var end = data[index].address; var request = { origin: start, destination: end, travelMode: google.maps.DirectionsTravelMode.DRIVING }; directionsService.route(request, function(response, status) { //console.log(response); if (status == google.maps.DirectionsStatus.OK) { value.driveTime = response.trips[0].routes[0].duration.value; //console.log(response.trips[0].routes[0].duration.value); }; }); }); var closest_store; $.each(data, function(index, current_store) { if (index == 0) { closest_store = current_store; } else if (current_store.driveTime.value < closest_store.driveTime.value) { closest_store = value }; console.log(current_store.driveTime); } ) });

    Read the article

  • Can I show a single country (masked out) in GoogleMaps?

    - by NIclas Lindbegr
    Hello! Is it possible to mask away neighbor countries in GoogleMap? In my case I just want to show Sweden on one view. On a second view just Norway, Denmark etc etc... I know it is possible to draw polygon lines and fill them accordingly on to Maps API. Problem is that or the result sets get huge or the lines get very rough etc... Would be nice if GoogleMaps could deliver a country at the time without neighbors. Does anyone know about a good coordinate database with country borders? Best best regards, Niclas

    Read the article

  • GoogleMaps API v3 - Need help with two "click" event scenarios. Need similar functionality to v2 AP

    - by Nathan Raley
    In version 2 of the API the map click event returned an Overlay, LatLng, Overlaylatlng. I used this to create a generic map event that would either retrieve the coordinates of the Map click event, or return the coordinates of a Marker or other type of Overlay. Now that API v3 doesn't return the Overlay or Overlaylatlng during the map click event, how can I go about creating a generic "click" event for the map that works if the user clicks on a marker or overlay? I really don't want to create a click event for each marker I have on my page as I am creating anywhere from a handful to a couple thousand markers. Also, I had to create a custom ImageMapType in order to display the StreetViewOverlay like we could do in v2 of the API because I couldn't find anywhere that told me how to add the StreetViewOverlay without the pegman icon. How can I go about retrieving the LatLng coordinates of a click on this overlay type as well?

    Read the article

  • Geocoding Chinese addresses using Google Maps API in Python?

    - by Jack Low
    I have looked into Geopy and googlemaps (http://py-googlemaps.sourceforge.net/) and they both do not work for Chinese addresses. My app is stored on the Google App Engine. What I want to do is to parse a file containing addresses of restaurants in Hong Kong, and then Geocode the addresses and store the Lat and Lng in the datastore. How do I do this?

    Read the article

< Previous Page | 1 2 3 4  | Next Page >