Web 2.0, free Api, Google Maps, Cyrillic or one difficult night


    And then he says to me: “How is this our service without cards? Well it's not 2.0 We do the Web! » . Hearing the sacramental Web 2.0, I tensed internally. Usually this means a week of work without days off, to implement some beautiful garbage, seen by the authorities on the vast expanses of the Internet. Giving my face a clever expression (and it happens), I set out to describe the difficulties and dangers of developing an application for working with maps. But my flight of thought was barbarously interrupted.

    “There are GoogleMaps . Everything has already been done there for us. They, I heard, have a good Api , and it's also free. You just need to fasten it quickly. A couple of hours of work. ”

    After the key phrases “quick” and “Work for a couple of hours”, I realized that today's sex with the girl was covered with a copper basin. And indeed in the coming days, Internet Explorer will become my regular sexual partner.


    The task seemed rather trivial, it was necessary to determine where, from which city the user came from and display it on a map. That is, the user, having seen a small red flag pointing to his dear Sukhodrishchensk, starts jumping with happiness and stays on the site forever. You also need to store the coordinates of his favorite places and, accordingly, highlight them on the map.

    Surprisingly, Api turned out to be pretty nice and even well-documented; there were no problems with positioning maps and marker management. For joy, I even started humming songs from the repertoire of my favorite rock bands. Apparently, these terrifying sounds woke up the programming demons, and they decided to take revenge on me.

    The fact is that while the user enters data about his location, he has to position it by geoip. It returns the coordinates, and from them it is necessary to determine the nearest city and present it. But to know the coordinates of the city, I need to know its name.

    "Pancake. What to do? ” I said (in literary translation).

    Like what? Know in advance all the coordinates of cities and save them in the database. Seeing the goal in front of me, I was delighted and even wanted to sing, but stopped in time (there is nothing to disturb the demons in vain). Needless to say, Google does not understand the native Cyrillic names of cities - only in English. “So you just need to translate!” The demons howled joyfully in my head (at about half past one in the night they took pity on the unenviable programmer’s share and started to help). A couple of hours later it turned out that everything was not so rosy. Either my knowledge of grammar, I remember, was 3 in Russian, or the phase of the moon, but it did not work to generate the English name automatically.

    “And how do I solve this problem?”I said (no, really, I said so: “And how can I solve this problem?”). For some reason, the idea to use some translator did not come right away ... After half an hour, the script was ready. Just a couple of minutes - and all the cities are transferred.

    The last step remained - to get these coordinates cursed by all gods.
    Another script was written and launched, I already look forward to the joy of victory and;%;% *? MM (% Y%; *?) (Untranslatable puns). Google banned me!
    “There must be a virus on your computer.” What the hell ?! 20,000 requests at a time is normal behavior for the user. I live faster than surfing (I just fall for F5, so many resources think that I will finish them).

    Raising my hands to heaven, I proclaimed: “Why do all good things need to be done in dirty ways ?!”

    Well, of course, the good old list of free proxies helped me out this time too.

    And now (carcass music) the list of cities in my database. Congratulating myself loudly (at 4 in the morning there is still no one in the office), I went with a sense of accomplishment to look for food. But that's another story…

    Oh yes, I completely forgot. Any story should make sense, well, except for stories about Friday's booze. And the point is that if you want to use free Api, then get ready for what you always have to bring to mind. After all, developers write Api, guided by their own, and not your functionality. However, it is worth using the benefits of others. Just count how long it takes to write your own map service! Here the selection criterion is probably the same as when choosing third-party libraries. If functionality is key to your start up, then definitely write it yourself. That is, a Flickr-based photo gallery is unlikely to work, and if it’s necessary, it’s a feature, then you can have fun with someone else’s Api.

    And yet, for anyone (even the most useful and good deed), you still need a list of free proxies.


    Also popular now: