开发者

Is there a way to return LatLng, Google Maps' format for points, from a mySQL database

Is there a way to return LatLng, Google Maps' format for points, from a mySQL database? I'm using Flex 3 and MySQL with Google Maps.

Currently, I select latitudes and lon开发者_如何学JAVAgitudes from my mySQL table and then iterate over them in Flex in order to make the LatLng for Google Maps.

public function latLngCreator():void {
        myLatLngArray = [];
        var i:uint;
        var arrayCollectionLength:int = myData.length;

        for  (i=0; i < arrayCollectionLength; i++) {
            myLatLng = new LatLng(myData[i].latitude, myData[i].longitude);
            myLatLngArray.push(myLatLng);
             } 

Is there a way to skip the above step and select the latitudes and longitudes from the table and create the LatLng in PHP? This way I wouldn't have to iterate over the result and hopefully it would be faster.

Any suggestions?

Thank you.

-Laxmidi


I don't think there is a way for this to happen. I am assuming you are using google maps v3. google.maps.LatLng does not accept deserialized JS objects, it only accepts 2 parameters as (lat, lng).

Furthermore, moving from the back-end to the front-end the data has to be serialized, and then deserialized. These actions can be just as performance intensive.

What you don't want to do, is write javascript/actionscript from PHP to create these objects. I have seen this happen, and the delivery was too large to handle the file and compiled twice.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜