The extreme large number is the correct number -- unless you live in near London (Lng 0) or at a small zoom.
The error is likely in somewhere else, but again, you should take time to produce a smaller page and include all the code you think problematic. On Jun 5, 12:36 pm, jamie <[email protected]> wrote: > Hi Group, > First, let me please explain that can not provide a map page link - > the page in question is can not be made publicly available as it would > require giving uber-account access to the world on our site, something > I can not do ;( > > Abstracting the code to a stand-alone page is not really an option > either, as a lot of the page is dynamically generated. > > I am trying to place a map overlay but keep it's proportion with the > original image. > > The original code drew a rectangle inline of the map container > boundries around a GGroundOverlay - this is working perfectly, but I > need to try and maintain the aspect ratio of the groundOverlay image > itself. > > The North East point is drawn first, inset from the top right corner > of the map container - this works perfectly. > > The dimensions of the overlay image have already been stored in an > object (fp_dimensions) as w & h (width and height). > > I convert the North East point position to pixels, which gives me > extreamly high numbers, not what I was expecting: > x: 18108180 > y: 11363591 > > From this I minus the width and height of the groundOverlay image > > I convert these values back to lat/lng > > And place the South East positioning handle - which ends up a long way > from where it should be, top right of the map. > > My apologies again for posting a code snippet, flame me please if you > feel the need, but here goes: > > function fitFloorPlanToMap() > { > marker_NE.setPoint( padBounds( map.getBounds(), true ).getNorthEast > () ); > > var NE_pixels = map.getCurrentMapType().getProjection > ().fromLatLngToPixel(new GLatLng(marker_NE.getPoint().lat(), > marker_NE.getPoint().lng()), map.getZoom()); > > //add image width to it in pixels > var fixed_image_ratio_w = NE_pixels.x - fp_dimensions.w; > > //add image height to it in pixels > var fixed_image_ratio_h = NE_pixels.y + fp_dimensions.h; > > console.log(NE_pixels.x - fp_dimensions.w, NE_pixels.x, > fp_dimensions.w); > console.log(NE_pixels.y - fp_dimensions.h, NE_pixels.y, > fp_dimensions.h); > //convert this back to lat > var SW_latlng = map.getCurrentMapType().getProjection > ().fromPixelToLatLng(new GLatLng(fixed_image_ratio_w, > fixed_image_ratio_h), map.getZoom()); > > //use this coord for bottom right point > marker_SW.setPoint( SW_latlng ); > > console.log( SW_latlng ); > > updatePolyline(); > > } > > Can anybody please see what I am doing wrong? > > I am sure that when I am converting the North East point lat/lng to > pixels I am not being returned the correct values, but I can not for > the life of me see why??? > > Any help much appreciated > > Thanks in advance > > Jamie --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Google Maps API" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/Google-Maps-API?hl=en -~----------~----~----~----~------~----~------~--~---
