Question

So im basicaly trying to generate pois on mapquest from a database. i have all i need the flex application is set and the database working but i kind of got stack on the process. does anyone have any examples or know of any tutorials i can use?even if it is for google maps flex api it would be really helpful.thanx

Was it helpful?

Solution

ok so basicaly the problem was that all the services must run on the creation of the new view or they wont run correctly on the functions. solving that let me continue with my solution which i will provide as a help for any new developers on mapquest.

private function createPois():void
        {

            [Embed (source='views/mapicons/hotel.png')] var hotelImg:Class;

            for (var i:int = 0; i <countResult.lastresult-1 ;i++)
            {
                var latLng:LatLng;
                latLng.setLatLng(getAllMarkersResult.lastResult[i].lat,getAllMarkersResult.lastResult[i].lng);
                var myPOI:Poi = new Poi(latLng);

                var icon:MapIcon = new MapIcon();
                icon.setImage(new hotelImg(),64,64);

                myPOI.label = getAllMarkersResult.lastResult[i].name + " - Academic Building";
                myPOI.labelVisible = false;
                myPOI.icon=icon;
                myPOI.rolloverAndInfoTitleText = getAllMarkersResult.lastResult[i].name;
                myPOI.rolloverContent = getAllMarkersResult.lastResult[i].name;
                myPOI.infoContent = (getAllMarkersResult.lastResult[i].description);

                dbColl.add(myPOI);
            }
        }

The logic is really simple. I create a loop which will run for the number of entries in the database and i use the countResult php service to get this number. From there the only thing i had to do is follow the add poi methodology for mapquest but giving data from the database to all the variables. In order to do that i used the getall methodo and the token lastresult which saves all the data. I believe my code is pretty straight forward and it will help new developers for Flex Mobile and MapQuest

OTHER TIPS

I don't know of a MapQuest Flash Maps API/database example right off the top of my head, but if I find one, I can post it here. Just a quick question; are you using something like AMFPHP or ColdFusion to connect to your database? Flex itself cannot connect directly to a database, so just wanted to mention that in case it is what is giving you trouble. Other than that, once you're able to work with the database, you can query it and then use loops to loop through the results and add the POIs to the map. Hope this helps!

Also, the forums on the MapQuest Developer Network are a great resource -- there may be some information about this topic there (but I haven't checked yet).

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top