Hi Javier- I always recommend McClure's script. Post in the general Maps API group, they may know of more encoding resources.
- pamela On Tue, Sep 2, 2008 at 9:07 AM, Javier de la Torre <[EMAIL PROTECTED]> wrote: > > Hi, > > By the way I am also creating Polygons from Encoded polylines. It > works great. There is even support for holes in the polygons and works > great, good job. > > In my case I am using Java for the backend and I made use of a class > from Mark McClures (found at > http://code.google.com/apis/maps/documentation/#Other_Resources) > . The encoded of the points work fine but i always get the same > encodedLevels. This class does not seem to take care of finding the > encoded levels. > Do you know of any other Java resource to help me on this? > > At the end what I am doing is represeting MULTIPOLYGONS features from > PostGIS in Google Maps for flash;taking care of holes and simplifying > geometries on the fly. I am trasnfering the polygons as encoded > polygons using AMF. It works very well for my polygons. If anybody is > interested I can provide the code. > For zooming and panning the map when the polygon is loaded I do what > you suggested and works fine for me. > > Javier. > > > On Sep 2, 2008, at 5:52 PM, pamela (Google Employee) wrote: > >> >> You should be able to simply do these lines: >> addOverlay(encodedPolyline); >> var bounds:LatLngBounds = encodedPolyline.getLatLngBounds(); >> setCenter(bounds.getCenter()); >> setZoom(getBoundsZoomLevel(bounds)); >> >> Does that not work for you? - pamela >> >> On Tue, Sep 2, 2008 at 8:20 AM, 123gotoandplay <[EMAIL PROTECTED] >> > wrote: >>> >>> hi all, >>> >>> how do i get the bounds with EncodedPolylineData and center the map >>> around the polyline ?? >>> >>> i tried >>> [code] >>> private function onMapReady(event:MapEvent):void { >>> //our polypoints as flashvars >>> var flashVars:Object = >>> LoaderInfo(this.root.loaderInfo).parameters; >>> var sTitle:String = flashVars.sTitle; >>> var sDescr:String = flashVars.sDescr; >>> openInfoWindow(getCenter(), new InfoWindowOptions( { title: >>> sTitle, >>> content: sDescr } )); >>> >>> /* >>> * Add an encoded polyline. >>> */ >>> var encodedPoints:String = flashVars.aMapPoints; >>> var encodedLevels:String = flashVars.sMapLevel; >>> >>> var encodedPolyline:Polyline = Polyline.fromEncoded( >>> new EncodedPolylineData(encodedPoints, 32, encodedLevels, 4), >>> new PolylineOptions({ strokeStyle: new StrokeStyle({ >>> color: 0x0000ff, >>> thickness: 4, >>> alpha: 0.7}) >>> })); >>> >>> /*center around route*/ >>> var bounds:LatLngBounds = encodedPolyline.getLatLngBounds(); >>> var n:Number; >>> for (n = 0 ; n < encodedPoints.length-1; n++) { >>> bounds.extend(encodedPoints[n]); >>> } >>> setCenter(bounds.getCenter()); >>> /*end center around route*/ >>> addOverlay(encodedPolyline); >>> >>> } >>> [/code] >>> >>> the /*center around route*/ part doesn't work? >>> >>> Any ideas? >>>> >>> >> >> > > > > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Google Maps API For Flash" 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-for-flash?hl=en -~----------~----~----~----~------~----~------~--~---
