Navigation

Projects‎ > ‎

Building photo density maps with Panoramio

Territorial photogenicy.


Original idea by komelsky (here).

Technology.

This technology built to avoid Panoramio API issues.

Step 1
First, you must select these values:
1. Region (like Europe, Russia, Moscow etc.).
2. Proccessing depth (PD). How deep will algorithm go trying to pass below maximal number of photos. This value is not limited, but when you divide to deep polygons become too small and issue #1 can occur.
3. Maximal number of photos (MNP) for polygon. This value has to be less than 20000, because of Panoramio API issue #2.
4. Density map dimensions (width, height) for region. Because at each iteration dimensions are divided by 2 the whole region density map must have dimenstions equal to power of 2.

Step 2
Then if region (biggest polygon itself) has more than maximal number of photos it recursively divided into four equal polygons. And so on for each of these polygons.
Depth of this recusion is proccessing depth.

Step 3
On this step of algorithm some files are generated:
1. KML containing polygonal map made of polygons that have number of photos less than MNP, or greater than MNP but at maximum proccessing depth (smallest possible).
2. KML containing overlay map. The same stuff, but instead of polygons it contains image overlays. Image overlays won't show at this moment because of no images.
3. Shell script (BASH, that works on Mac OS X & Linux very fine) #1 called "Get photos".
4. Shell script #2 called "Overlays prepare".

Step 4
Polygonal map KML can be postproccessed and used as visual material itself. Examples you can see below at "Polygonal maps" section.
Postproccessing made to color polygons or to transform them. There are few types of postproccessing now, though it's number unlimited:
a) Type C — red polygons with transparency depending on denisty of maps at polygon. Ugly, mostly at close ups.
b) Type D
— yellow grid with no polygons color transformed (originally it became brighter with polygon getting smaller). Grid density represent with some approximation density of photos and transformation looks fine at distance.
c) Type E — red-yellow-white (RYW) gradient with non-contrast transparency:

Using the samples this gradient can be described as R/G/B/T = 11111/0+111/00+11/+111.
Very vivid type of transformation yet comparision of almost equal polygons still not so clear.
d) TypeF — the same gradient, but polygons transformed into histogramm bars (to be honest, somethins like bars =). Height of bars determined visually and can be set.
Height of bar represent number of photos at region divided by polygon size — denisty.

Pictures (and KMLs) in "Polygonal maps" section are Type E and Type F transformations.

Step 5
At this step for each polygon every photo is got and according to it's coordinates value of corresponding point on density map increased (double-dimension array).
Dimension of map calculated based of whole region map dimensions and level of depth for polygon, for example: if whole region has 1024×1024 map, at next level (first division) all polygons will have 512×512 maps, at next level 256×256 and so on.
Also at this step maximal point value for each polygon is stored in log. When all polygons proccessed maximal point value amoung all polygons is calculated. It will be used at next step for normalisation.

Step 6
Using maximal point value and density maps, PNG-images are built for each polygon. Images have same dimensions as density maps.

To make density map more vivid at this step we also apply gradient map. It can be chosen from number of presets or manually specified using samples.
I like this one (black-red-yellow-white condensed, or BRYW_C, condensed means it has smaller black region):

Step 7

All images are stuck together resulting whole region overlay image with dimensions of denisity map for whole region.

Picture:

0. Whole region.
1. Divided into polygons.
2. All polygons proccessed separately.
3. Density maps are built.
4. Images are built.
5. Whole region density map image constructed.

    Polygonal maps.

    All images presented are Google Earth screenshots.

    Raw (step 3 polygonal map KML output) polygonal maps for Europe, Asia, Africa, Australia & Oceania:
     


    Step 4 postproccessing demonstation:

    No postproccessing
    KMZ
    Type D
    KMZ
    Type C
    KMZ

    Type E





    ... and Type F

    and Lightspeed bars =)
    This bars are wrong because you can't recognize if region have more than 2000 photos.

    Moscow (Russia).




    Better look on larger image and KMZ.


    Amsterdam.




    Paris (France).

    KMZ



    More detailed photo density map at Paris (final output):



    Berlin (Germany).



    Rome (Italy).
    KMZ



    Correlattion of photogenicy and wikipedia:


    Photo density map of Rome:


    USA




    Working stuff.

    First take —Map (pic) built with wget and Microsoft Excel®. Resolution 10×10.

    ← This is Central Europe =)

    Project goal is to show bright spots on map at places with number of photos. Something like places popularity map at different scales — streets, town, region, country etc.
     
    The best resource where photos are tied to geographical locations is Panoramio. It gives all that necessary for the project and has the greatest database of photos with geo-location.



    Work is in progess. First aim is Europe and Russia. Then Africa, Asia and Australia.
    Here some raw processing results that can't be treated as final product.

    Crimea (Black Sea)

    JPG
    West Russia

    JPG

    Moscow (1st, 2nd)

     

    Reviews.

    1. Photo Density Google Maps @ Google Maps Mania
    2. Panoramio heatmaps @ Ogle Earth

    Legal.

    Project depends on open Panoramio API and made with other great Google products — Google Earth, Google Maps, Google SketchUp.


    Coded on command-line PHP primarily. Also Perl and BASH used.

    Made on iMac.

    Contact.

    Feel free to contact me — alexander dot tchaikin
    Č
    ą
    ď
    Alexander Tchaikin,
    Jul 17, 2008, 11:08 PM
    ą
    ď
    Alexander Tchaikin,
    Jul 17, 2008, 10:07 AM
    ą
    ď
    Alexander Tchaikin,
    Jul 17, 2008, 10:13 AM
    ą
    ď
    Moscow.jpg
    (719k)
    Alexander Tchaikin,
    Jul 9, 2008, 12:50 AM
    ą
    ď
    Alexander Tchaikin,
    Jul 9, 2008, 12:49 AM
    ċ
    ď
    Paris.kmz
    (282k)
    Alexander Tchaikin,
    Jul 17, 2008, 11:51 PM
    ą
    ď
    Alexander Tchaikin,
    Jul 10, 2008, 1:13 AM
    ą
    ď
    Alexander Tchaikin,
    Jul 10, 2008, 1:17 AM
    ą
    ď
    Rome.jpg
    (711k)
    Alexander Tchaikin,
    Jul 8, 2008, 8:28 AM
    ċ
    ď
    Rome.kmz
    (199k)
    Alexander Tchaikin,
    Jul 17, 2008, 11:45 PM
    ą
    ď
    Alexander Tchaikin,
    Jul 8, 2008, 10:37 AM
    ą
    ď
    Alexander Tchaikin,
    Jul 9, 2008, 1:20 AM
    ą
    ď
    Alexander Tchaikin,
    Jul 11, 2008, 3:59 AM
    ą
    ď
    Alexander Tchaikin,
    Jul 8, 2008, 11:02 AM
    ą
    ď
    USA.jpg
    (798k)
    Alexander Tchaikin,
    Jul 8, 2008, 9:30 PM
    ą
    ď
    Alexander Tchaikin,
    Jul 8, 2008, 9:30 PM
    ą
    ď
    Alexander Tchaikin,
    Oct 2, 2008, 12:15 PM
    Comments