Monday, March 28, 2011

Partly Cloudy - Node.js and the IFS

With Node.js surfing the hype wave, we have received some requests from our clients on how to use Node.js to poll the IFS web services.

This is actually a good idea ... let me add another buzz word to explain why: SEO.

In the following scenario we'll make Node.js call the casa.keru search service from the Tredix IFS and serve the results as HTML to the browser. The result will be a static web page listing some properties for sale.

It is very important to understand the difference between a static and a dynamic web page. In most of our other examples (including the casa.keru.pt web application itself), we are calling the IFS web services from within the browser. This technology is commonly known as AJAX; the DOM is manipulated on the fly. AJAX is really cool and fun to use, because all the magic happens dynamically within your page without any page reloads. However, in SEO terms, AJAX is not helpful at all. When the Google bot stops by, it can only index the static content of our page (which is usually not much more than a HTML wrapper) - but not the dynamically generated content. However, this is where the beef is.

So the good old fashioned static web page can still be desirable, especially in terms of SEO. With Node.js, there's no need to write a server side program in yet another language such as PHP, Python, Ruby or ASP.NET/C#. Instead, JavaScript developers can use their client-side JavaScript skills to let rip on the server.

Plus: It's incredibly simple! Check out the basic example below which sets up a web server on 127.0.0.1:8124, calls the IFS search service, and delivers a static list of properties to the browser. Each time you hit refresh, you'll skip to the next page of property listings. The code is pretty self-explanatory and should allow for an instant start - enjoy!

// tested on Node.js 0.4.x

var http=require('http');

var GroupID='PT-08_ABF_01'; // Freguesia Albufeira
var counter=0, html="";

http.createServer(function (req, nodeResponse) {

  // Ignore browser requests for Favicon
  // console.log(req.url);
  if (req.url=="/favicon.ico") return false;

  counter++;
  var options = {
    host: 'arrakis.tredix.com',
    method: 'GET',
    port: 59180,
    path: '/apache-tomcat/Tredix/ISS?Context=Tredix/IFS/ImmoPT/ProtoTyp2/Search&ContentType=json'+
    '&BusinessType=SALE' +
    // '&PropertyType=' +
    '&MinPrice=0' +
    '&MaxPrice=0' +
    '&NumberOfBedrooms=' +
    '&Language=PT' +
    '&IncludeObjectsWithPriceOnApplication=true' +
    '&IncludeBoundaries=false' +
    '&IncludeMisses=false' +
    '&Currency=EUR' +
    // '&Tags=' +
    '&ListNumberOfPage=' + counter +
    '&ListItemsPerPage=5' +
    '&GroupID='+GroupID +
    '&SortBy=PriceASC' +
    '&ResponseDetails=List',
    headers: {
      "User-Agent": "Tredix CaKe Client"
    }
  };

  var ifsRequest = http.request(options, function(ifsResponse) {

    var responseBody = "";
    ifsResponse.setEncoding("utf8");

    // echo some IFS response details
    console.log('STATUS: ' + ifsResponse.statusCode);
    console.log('HEADERS: ' + JSON.stringify(ifsResponse.headers));
    console.log('counter: ' + counter);
    console.log('################');

    ifsResponse.on("data", function(chunk) {
      responseBody += chunk;
    });

    ifsResponse.on("end", function() {
      // build static HTML for the client
      html="<!DOCTYPE HTML PUBLIC '-//W3C//DTD HTML 4.01//EN' 'http://www.w3.org/TR/html4/strict.dtd'>";
      html+="<html><head><title>"+GroupID+"</title></head><body><table>";
      var hits = JSON.parse(responseBody),
      results = hits.SearchResult.ListHits,
      length = results.length;
      for (var i = 0; i <= (length-1); i++) {
        html+="<tr><td><b>"+results[i].Title + "</b></td><td><b>"+ results[i].Price+"</b></td></tr>";
        html+="<tr><td colspan='2'>"+results[i].Description + "</td></tr>";
      }
      html+="</table></body></html>";

      nodeResponse.writeHead(200, {
        'Content-Type': 'text/html; charset=UTF-8'
      });
      nodeResponse.end(html);

    });
  });

  ifsRequest.end();

}).listen(8124, "127.0.0.1");

console.log('Node server running at http://127.0.0.1:8124/');

Friday, March 11, 2011

What's that bird?

We proudly present Keru's new testemonial: a Peregrine Falcon!

Since our maps based sites use the bird's eye view for primary navigation, the choice of a bird was rather obvious. But why didn't we go for a funny parrot, a peaceful dove, a Portuguese stork, or some odd duck?

The Peregrine is renowned for its speed, reaching speeds of up to 290 to 390 km/h (180 to 240 mph), making it the fastest extant member of the animal kingdom. With a vision five times more powerful the human eye's, falcons spot their targets quicker than most other birds.

We liked these analogies to the speed of casa.keru and a growing number of other maps-based applications. Under the hood, instantaneous search, clustering and navigation are provided by the Tredix IFS.

Thanks again to our designer friend Rabea of La Bam for providing both a great concept and perfect realisation of Keru's new CI. Well done, right on time for the upcoming IMOBITUR real estate trade show in Porto.

PS: Our agency did tell us that we are not the first to use the Peregrine metaphor for speed ... ever heard of the Suzuki Hayabusa (or GSX1300R)?

Monday, March 7, 2011

casa.keru adds 50.000 properties around Porto

Just a quick note that, as of today, casa.keru is also covering the greater Metropolitan Area of Porto (Oporto). Right from the start, there are more 50.000 listings available in the district of Porto alone.

Located along the Douro river estuary in northern Portugal, Porto is one of the oldest European centres, and registered as a World Heritage Site by UNESCO in 1996. The area is very popular with travellers and home seekers alike.

In total, casa.keru is now promoting more than 100.000 properties for sale and rent in Portugal. Currently, the website is focussing on the two largest Portuguese cities - Lisbon and Porto - and the popular Algarve region. Full coverage of Continental Portugal is being scheduled for Q2/11.

Tuesday, March 1, 2011

casa.keru now covering the Lisbon Metropolitan Area

We are proud to announce the immediate availability of casa.keru in the Lisbon area.

Since it's launch less than ten weeks ago, casa.keru covered the Algarve exclusively. Meanwhile, there are more than 25.000 offers available in the district of Faro. 

As of today, casa.keru is presenting another 25.000 properties in and around the Portuguese capital. Within Portugal, the district of Lisbon has got by far the most agile real estate market. For the initial Lisbon data set, we have been working with almost a hundred real estate agents.

The doubling of the number of offers (50K+ in total) immediately reflects in casa.keru's local mirror sites (Spain, UK, Germany).

It is our declared objective to cover all areas of continental Portugal by Q2/11.

Saturday, February 19, 2011

Tredix IFS - Information retrieval done right

The Tredix Internet Find Store (IFS) is a custom framework developed for just one purpose: Search. Or to be more specific: Find.

IFS results are all about quality, relevance, and speed. Let's take a closer look at some of the IFS search services:


Full text search - The royal league of search

So the user enters some free text - but what does it mean? The IFS knows, because it understands linguistics: Language form, language meaning, and language in context. It works multi-lingual with language-specific stemming, lemmatisation, stop words, and normalisation. Distributed words as well as phrases are recognized and contribute to the quality rank. Synonyms and decomposed compounds provide additional hits. In case of literal errors, the IFS suggests language-independent phonetic similarities aka "Did You Means". Custom filters allow for flexible result manipulation.

If this is technobabble to you, here's a real world example of the IFS result quality. We recently built a demo for German fancy foods distributor "Bos Food". They have tens of thousands of special delicacies on stock. Since the goods originate from all seven continents, of course the product names are mostly foreign-language - and sometimes even made-up. French and spanish names might still sound familiar to the mainly German Bos customers, but what about those African or ethno food names? Clients simply couldn't spell the products, so Bos' classic SQL-based search failed continuously. People couldn't find the products and Bos lost massive business on his web shop.

When we replaced their SQL with the Tredix IFS (which by the way never got rolled out on their web site), search worked perfectly: Salsa Fumy would find Sansai Fumi, general queries like poultry or pastry would deliver both duck and chicken or cookie and pie; fishing would also find fish; and a solid German compound like Holzboot would even find Schiffchen aus Holz. Finally, just for the records, users of keyboards without diacritics would still be able to find Öl or Rougié, of course.

Selling is all about finding in the first place, isn't it?


Suggestions - Instant dynamic feedback

Unlike with a full text search box where you have to type a full search term and hit return, results in a suggest box will appear instantly as you type, helping you see where you're headed, every step of the way. The IFS Suggester supports pretty much all the search logic like its full text sibling, however quality and weight of the suggestions need to be calculated in a more "predictive" way. Since suggestions appear while you still type, we prefer to call them predictions as they actually help guide your search. So result ranking is vitally important.

Now apart from the different levels of match quality, usually popularity makes one of the most important ranking factors. However, under certain circumstances popularity can be misleading. Think about our casa.keru map application where you can jump to a geographic location by entering a location's name into a suggest box. In Portugal, many towns have the same name; for example, there are more than a dozen places called "Luz" all over the country. Imagine you are currently navigating around Faro on the southern coast of Portugal and want to zoom into the Luz area in the Eastern Algarve. If the IFS Suggester would simply rank the most popular (most searched for) city of Luz best, you would be taken to the city of Luz north of Lisbon.

Fortunately, the IFS framework exposes plugin interfaces to further customize each service. Since we are not searching for the best text match but the best location match, we added geographic distance calculation to the ranking algorithm in casa.keru. You guessed it: The IFS would now suggest to take you to the city of Luz in the Faro neighbourhood, which is usually the desired effect for people hunting for homes on casa.keru. This is a good example on how to transform a simple text suggestion into a smart location prediction.


Geologic - More intelligence for maps

Talking about location, the IFS provides native search on maps, too. The IFS Geofinder usually returns a set of coordinates for a given filter set and map section. In this context, result representation poses the biggest challenge. Geo point density must be adjusted in relationship to the map dimensions and zoom level. So the IFS Geofinder combines stacked coordinate pairs into clusters where necessary. This way, a perfect representation on the map is always guaranteed. For more non-technical information on the advantages of clustering, please see my post "Clustering is key to map application success".

On top, the IFS Geofinder also provides all the necessary geopolygon logic to identify area relationships, distances, proportions etc. on the server-side. Geo points can be allocated within areas like city limits or administrative divisions. Apart from providing the parent subnational entities like parish, district, etc. for any given coordinate, geopolygon logic is also extremely useful for tagging the Geo points. If, for example, you got a polygon of a nature reserve or a polyline of the coastline, the coordinate could automatically get tagged with "Ria Formosa" and "beach-front". Tags are supported in any IFS search service.


Today we have learned about some key features of the IFS search services. But how about reusability, integration, scalability, and customization of these services? I'll talk about the design of the IFS framework in one of my next posts. So keep following - further blog updates are on their way.

Wednesday, February 16, 2011

Improxy and Keru sign partnership agreement

Porto, Feb. 14, 2011:  Improxy, Lda (Vila Nova de Gaia, Portugal) and Tredix Keru, Lda (Arroteia, Portugal) have signed a partnership agreement which will allow all real estate companies using Improxy's Gimob.net solutions to export their properties into the Keru portals. Besides feeding casa.keru.pt, Improxy will be the charter data supplier for arrenda.keru.pt, Keru's upcoming portal for long-term rentals in Portugal. Additionally, Gimob.net will provide deep links into Keru's map applications.

About Improxy

Improxy is a software house founded in 1998 with headquarters in Portugal. The company focuses on software and Internet solutions for the real estate business. Considered a main player in the Portuguese market, Improxy is now also serving countries like Brazil, Angola and Mexico. 

Improxy - Tecnologias de Informação, Lda
Paulo Alexandre
Tel.: +351 223 749100
EMail: palexandre@improxy.pt


About Tredix Keru

Tredix Keru, founded in 2011, is privately owned by Tredix GmbH and Mr. Felix Schormann. The company specializes in maps based consumer portals, utilizing innovative search technologies provided by Tredix GmbH, Germany.

Tredix Keru, Lda
Felix Schormann
Tel.: +351 289 798041
EMail: felix@tredix.com

Five pretty cool features in casa.keru

Have you already discovered these usability features?

1. Even in list view, the map is alive - move around just like in the big map:




2. Navigate faster with the Drag & Zoom feature - just click the magnifying glass icon:




3. Narrow your result set by setting tags - just click the Tags button:




4. Some statistics will help you learn about the area - just click the number of properties:




5. Use your browser's history to navigate back - it works for areas and property listings:




... and now try for yourself at casa.keru.pt !

Monday, February 14, 2011

Hola España

Sometimes we just go there for a real good Spanish coffee or a sherry, depending on the time of the day; Spain is just a half an hour drive from the Tredix Cube. A visit to a tapas bar is always a good reason to go, too ... little things that sweeten your day.

On a much bigger mission, an increasing number of Spanish come to the Algarve to buy property on the South Western coast of the Iberian Peninsula. To allow for a more convenient localized property hunt, today we have published a Spanish clone of casa.keru. You can find the Spanish version at CasaPortugal.es.

Currently, the website has more than 23.000 properties on offer in the Algarve alone.

Tuesday, February 8, 2011

Clustering is key to map application success

In view of rising smartphone demand, new Location Based Services (LBS) are being introduced almost on a daily basis. If you share your position with these services, they will connect you with friends or recommend businesses that are physically located nearby. In most cases LBS are all about social geolocation and navigation.

A map view is the natural way to visualize the matching POIs (points of interest) around you. Now imagine looking at the restaurants in your town from a distance (e.g. from an aeroplane): Depending on the zoom level and service, an app can easily deliver hundreds or even thousands of POIs.

And, unfortunately, lots of applications really do ... they clutter the map with hundreds or thousands of markers. In this scenario, markers overlap. Users run into problems trying to select the POI they want on the map and end up accidentally selecting the wrong one.

Other apps artificially limit the number of results and ask users to either narrow their search or zoom in further until results are within a range that displays well. This sounds decent in theory but, in reality, is confusing and frustrating to analytical users.

Both approaches limit usability without a reason. Even when there are dynamic components (like yourself driving in a car) involved, the mayority of POIs like shops etc. are static: You are moving, not the bricks and mortars.

The solution is very simple: Just combine overlapping static markers until you get close enough to see the details. This concept is called clustering. So from the plane we would only see some restaurant clusters distributed within the city limits, but when we get closer e.g. on a quarter or street level we see single markers for each and every restaurant located nearby. Data represenation feels smooth and clean while the user always receives the perfect information level: An overview from the distance and the full details from the next-door location.

So if clustering is key for any map based application - why don't we see more clustering in the wild?

The reason is trivial: Developing clustering solutions is not trivial. It's actually quite a challenging task.

Client-side solutions don't make much sense; a browser would need to receive all the marker data and do some heavy clustering calculations, just to finally render a minimal subset of the original coordinates on the map. Note well, this expensive computation needs to be done every time search parameters are redefined.

So clustering must happen on the server-side. Some RDBMS do support GIS data but lack flexibility, extensibility, and often performance.

Clustering on casa.keru is provided by the Tredix Internet Find Store (IFS). The framework stores all POI data and offers comprehensive search support for map based applications.

In the clustering scenario, casa.keru simply requests the POIs for a given map dimension via HTTP GET and receives a standard JSON response containing the perfect cluster and marker selection - done! No, it's not even necessary to specify a zoom level. And yes, it works cross-domain.

IFS services are highly customizable. In the case of casa.keru, besides geometric clustering there was a need for editorial clustering. We provided the IFS with fixed cluster points marking the centers of districts, counties, and parishes. These should dynamically mix with geometric clusters or under certain conditions even merge with them - no problem.

Clustering is just one out of many forward-looking IFS search service features that made their way into casa.keru.pt, providing the website with a significant competitive advantage. We'll follow up on other key services of the framework on this blog, so stay tuned.

IFS services can be rented from Tredix GmbH.

Sunday, February 6, 2011

"Location. Location. Location."

The cliché "Location. Location. Location." has been tossed around in the real estate industry quite often. There is a reason for that – Location is the single most important factor that determines the value of a piece of real estate. You can always change the house, but you can't change it's position. A seafront property is typically more expensive than a similar place upcountry. So the location mantra is really all about the vendor's price tag.

But what does location mean to the buyer?

Most of today's real estate websites seem to cut location down on some geographic position. The client is prompted to first select some county or parish before he can even see a list of properties for sale. Now what if the perfect match would sit just 10 meters outside of the selected administrative area? Can we expect the client to search the neighbouring parish next, and does he even know the parishes' name? Probably not. So reducing the "Location" aspect on locking the client into some administrative areas like counties is not always a purposeful and target oriented approach.

Granted, knowing that the client is looking for a property in the Lagos area is important information - but actually not much more than a starting point. It's just one aspect of location. What about lifestyle, neighbourhood, distance to the sea, etc.? How would you make such kinds of parameters findable?

With casa.keru we have developed a combination of different techniques to achieve a most flexible search path.

Location (in the literal sense)

Most importantly, casa.keru is displaying all properties on a map. The map view is way superiour to a list view because it frees the user from being caged in the boundaries of an administrative area. Navigation is fast and easy as the user can go straight to his starting point by typing the name of his favourite neighbourhood (e.g. "Lagos").

Neighbourhood analysis

From there, the neighbourhood can be explored on the map. The user walks along the coast line and sees all properties that match his budget and other criteria. Satellite imagery, Street View (where available) and photos of the surroundings give a solid impression of the area. Furthermore, statistics on average sales prices, the types of properties for sale etc. provide important social information on the current viewport.

Lifestyle segmentation

So called "tags" allow for narrowing your selection by as many different characteristics as you like. The possibilities go beyond flat filters like "pool" or "elevator": Geographic tags such as "nature reserve" combined with activities tags like or "watersports" allow for better property preselection. Adding some location tags like "golf course" and "Resort" on top will lead to perfect lifestyle segmentation.

Maps and "Location. Location. Location." seem very complimentary to us. Plus, at casa.keru.pt, we got "Location. Location. Location." to work for the buyer, too.

Sunday, January 23, 2011

Bringing 20.000 Algarve offers to the UK

Traditionally, the Algarve has been the first choice of British people purchasing second homes in Portugal. So what could be more obvious than to make our casa.keru's Algarve offers available right in the potential buyers's domestic market?

Today, we have launched PortugalRealty.co.uk, extending the reach of our portal into the UK and beyond.

Since casa.keru's start in Portugal only 4 weeks ago, listings have doubled. We are now presenting more than 20.000 offers in the Algarve alone, still counting.

For your convenience, all prices on Portugal Realty are labeled in British Pounds. You might see some odd-value pricing due to the current EUR/GBP conversion. The exchange rate is updated on a daily basis. Of course, the ruling price is the Euro amount stated in each property's description.

PS: Happy birthday, Felix!

Thursday, January 13, 2011

Behind the name: "keru"

Lots of our visitors from abroad were asking: What does the name keru stand for?

The answer is really simple: In Portuguese, "keru" is the phonetic transcription for "quero" which means "I want ...". Our dear friend Isabel from Lisbon came up with this idea. She's an excellent copywriter and very good at wordplays - thanks again, Isabel!

The implication for our customers: casa.keru.pt is the place to go if you want a house (casa), and some day maybe a car, boat, job, friend, deal, or whatever ...

So "keru" works very well for our domestic users. BTW, with over 260 million speakers, Portuguese is the fifth most spoken language in the world (and the second fastest growing European language after English on the planet).

When we did some research, besides Keru being a city in Eritrea we found two other remarkable connections to the word:

- In Japanese, "keru" means "to kick". We like that, we get a kick out of it, too. You can listen to the original Japanese pronounciation spoken by lovely Mezashi from Tokio (actually, it really doesn't sound so much different from the Portuguese articulation).

- In the Star Trek universe, Lieutenant Commander Ranul Keru was an unjoined Trill who served as a Starfleet officer in the late 24th century. He served as a stellar cartography (!) officer on the USS Enterprise-E.

We don't know about the rest of the universe, but it looks like "keru" would also make a great brand name in Japan ...

Tuesday, January 11, 2011

How fast is the IFS, really?

Today I saw an interesting presentation on modern server latency.

L1: 3 cycles
L2: 14 cycles
RAM: 250 cycles

Disk: 41.000.000 cycles
Network: 240.000.000 cycles

The Tredix IFS stores all data in-memory (RAM). Any XML source data is really just a transport format. We replicate it into memory, rewriting the data for optimal memory access, and even cache read access intelligently on top.

Can your DBMS deliver suggestions, full text, or geographic search results in milli- or microseconds? No need to answer ... How about result sets like Did you Means or geo clustering. OK, never mind.

So how fast is the IFS really?

Lightning fast.

Living in Keru - Another late night session on the API, Episode 1

Your properties, mapped (1/3): The basics of "Search"

All right, so you are a real estate agent or developer and all of your offers have been included with casa.keru - nice!

But wouldn't it be great to have this same cool bells and whistles map representation of your properties on your own web site?

"Of course", you will say, "but isn't that terribly complicated?"

Long answer: No.

Today we'll talk about integrating casa.keru maps into your web site - it will only take 20 minutes. This is what the result will look like:


Here we go … we will build a single small HTML page presenting all of your properties for sale on a map, allowing for basic yet complete user interaction.

Prerequisites: Besides some  basic knowledge of HTML and JavaScript, an HTML editor is essential for this session. In case you don't have one installed, notepad.exe will do. Other suggested tools include the Firefox browser with the latest Firebug Add-on (1) installed.

First, we create a very basic HTML structure which marks the starting point for any HTML document:

<html>
<head>
<title>My own casa.keru property map</title>
</head>
<body>
</body>
</html>
Listing 1

Now, we'll add some content to the page in three easy steps:
  • Step 1: The HTML
  • Step 2: Some Includes
  • Step 3: The JavaScript logic

1) The HTML

Creating a Google map within our web page is very easy. Inside the <body> section of our code (somewhere between the <body> and </body> tags), we create a <div> that will later contain the map. Always specify the required dimensions; in this example the map will be 800 pixels wide and 400 pixels high.

<div id="map1" style="width:800px;height:400px;"></div>
Listing 2

Yes, that's right: The total HTML fits in just one line of code.

2) Some includes

In order to make the Google map come alive, we need to include the maps library with the HTML document. Also needed is the jquery (2) library which will make the connection between our page and the casa.keru server.

Insert the following block of code within the <head> section of your HTML document, right after the <title>:

<script type="text/javascript" src="http://www.google.com/jsapi?key=null"></script>
<script type="text/javascript">
  google.load("maps", "2.x", {"language" : "PT"});
  google.load("jquery", "1.4.4");
</script>
Listing 3

3) The JavaScript logic

For the map to come alive, we will need to put some logic into the page. The JavaScript code should not execute before the document is ready (fully loaded), so all of the code will go into the so called ready function:

<script type="text/javascript">
$(document).ready(function(){
  // one after another, insert all of the following code here
});
</script>
Listing 4

In step 1 and 2 we put both the maps container and library in place. We can now go ahead and initialize the map, put it into "hybrid" mode (satellite imagery with street names), add the standard user interface (zoom, panning, map type controls, etc.), define the viewport, and center the map which is necessary to draw it for the first time.

// initialize map
var map = new GMap2(document.getElementById("map1"));
map.setMapType(G_HYBRID_MAP);
map.setUIToDefault();
// set initial viewport, e.g. the Algarve
var algarveBounds = new GLatLngBounds(new GLatLng(36.94, -9.01), new GLatLng(37.53, -7.39)); //SW, NE
map.setCenter(algarveBounds.getCenter(), map.getBoundsZoomLevel(algarveBounds));
Listing 5

Save the HTML document and refresh it in your browser – voilá, we already got an interactive map in our page!

But where are the markers?

By this time, we are ready to request all of our properties from the casa.keru server in order to display the markers on the map. We need to have our user id provided by the keru team available (it is usually a four letter code like "ABCD").

We will put the request into a function called search() - this way, we can update the markers any time by simply calling this function, e.g. when the map viewport or zoom level changes.

"Who are you and what do you want?" I hear the server asking. So we need to give him some information before he can return the requested marker information.

Here's the information we provide below in Listing 6:
  • Our user id (UserID: "ABCD")
and the information we need ...:
  • markers, obviously (ResponseDetails: "Map")
  • limited to properties for sale (BusinessType: "SALE")
  • and particular property types (PropertyType: "Apartments, ...")
  • and narrowed by price (MinPrice/MaxPrice)
Additionaly, with every (!) single request, we need to pass the current viewport and dimensions of our map. The casa.keru server will spend some milliseconds on this information in order to deliver perfectly clustered items back to you.

Here's what the AJAX (3) call looks like:

// request your markers
function search() {
                   
  // call the casa.keru server
  $.ajax({
    url: "http://arrakis.tredix.com:59180/apache-tomcat/Tredix/ISS?Context=Tredix/IFS/ImmoPT/ProtoTyp2/Search",
    dataType: "jsonp",
    jsonp: "jsoncallback",
    scriptCharset: "utf-8",
    contentType: "application/json",
    data: {

      // your user id
      UserID: "ORBL", // e.g. Orbial - Soc. Mediação Imobiliária, Lda

      // request the results sets you need (map, list, tags, translations ...)
      ResponseDetails: "Map",

      // apply your filters (there are many more parameters and options ...)
      BusinessType: "SALE",
      PropertyType: "Apartments, DetachedHousesVillas, Townhouses, Lands, Ruins, FarmsEstates, CommercialProperties, Garages",
      MinPrice: 0,
      MaxPrice: 0, // == any

      // clustering needs map dimensions & viewport (mandatory for each request)
      ViewportLatitudeSouth: map.getBounds().getSouthWest().lat(),
      ViewportLongitudeWest: map.getBounds().getSouthWest().lng(),
      ViewportLatitudeNorth: map.getBounds().getNorthEast().lat(),
      ViewportLongitudeEast: map.getBounds().getNorthEast().lng(),
      MapDimensionX: $("#map1").width(),
      MapDimensionY: $("#map1").height()

    },
...
Listing 6

In response to our request the server will now return all markers for your current map size and zoom level. To prevent individual markers from being stacked, some might get combined into clusters if necessary. This is a really cool and pretty unique feature once you think about it. For the moment we need to understand that we are looking at two different types of markers:

MapHits representing one single property, and
MapClusters containing two or more properties.

Apart from the latitude/longitude coordinates, the casa.keru server also deliveres many more relevant details about each marker, e.g. title and your reference for a MapHit or the number of properties contained in a MapCluster.

The following code will clear all markers from the map and paint a new icon ("G" as in geo point) for each MapHit on your map. Since these are all individual properties, we'll add some information (title plus ref) in the markers' tooltips.

Additionally, we will register a click event for each marker. The code redirects to the real estate web site's search for the corresponding ref. So if you click on the marker, you go straight to the details of the property. This is just one out of many examples how to connect casa.keru information with your own content.

    success:function(data)
    {
      // clear map
      map.clearOverlays();

      // display geo referenced lat/lng objects (MapHits)
      if (data.SearchResult.MapHits!=undefined) {
        $.each(data.SearchResult.MapHits, function(i,item)
        {
          var geoPoint  = new GLatLng(item.Latitude,item.Longitude);
          var geoIcon   = new GIcon(G_DEFAULT_ICON);
          geoIcon.image ="http://www.google.com/mapfiles/markerG.png";
          var geoTitle  = item.Title + " (Ref. " + item.PropertyID + ")";
          var geoMarker = new GMarker(geoPoint, {
            title: geoTitle, 
            icon:geoIcon
          });
          map.addOverlay(geoMarker);

          // add geopoint click handler to connect to your web site
          GEvent.addListener(geoMarker, "click", function() {
            // e.g. search for property's reference
            window.location = "http://www.realestatealbufeira.com/pt/listagem.htm?ref="+item.PropertyID;
          });
        })
      }
Listing 7

We'll treat the MapClusters pretty much in the same way like the MapHits above (we are using "C" icons as in cluster). However, the click behaviour differs: When ever we click on a cluster, the map zooms in in order to eventually "spread" the cluster.

      // display clustered object groups (MapClusters)
      if (data.SearchResult.MapClusters!=undefined) {
        $.each(data.SearchResult.MapClusters, function(i,item)
        {
          var clusterPoint  = new GLatLng(item.Latitude,item.Longitude);
          var clusterIcon   = new GIcon(G_DEFAULT_ICON);
          clusterIcon.image = "http://www.google.com/mapfiles/markerC.png";
          var clusterTitle  = item.NumberOfObjects + " object/s";
          var clusterMarker = new GMarker(clusterPoint, {
            title: clusterTitle, 
            icon:clusterIcon
          });
          map.addOverlay(clusterMarker);

          // add cluster click handler to zoom into clusters
          GEvent.addListener(clusterMarker, "click", function() {
            map.setCenter(new GLatLng(item.Latitude,item.Longitude), map.getZoom()+1);
          });
        });
      }
    }
  })
}
Listing 8

Finally, it would be nice to see the markers updated when ever the user moves (drags) the map or zooms into or out of the map. We can easily listen for this kind of change through the dragend and zoomend events of the map. Once fired, they simply call the search() function which will update all MapHits and MapClusters immediately.

The following code should be inserted between Listing 5 and Listing 6:

// search() updates the markers on the map
search();

// update the map when the user changes the zoom level ...
GEvent.addListener(map, "zoomend", function() {
  search();
});

// ... or when the user drags the map / changes the viewport
GEvent.addListener(map, "dragend", function() {
  search();
});
Listing 9

That's it - the map application for your web site is all done! Wasn't that easy?

You can watch the demo here. It includes all the code we have just developed - just copy the source HTML of the page and paste it into your editor.

If you want to put your page straight into production, you will need to apply for your free personal Google Maps key (4) by providing Google with the domain name the map will run on (like www.yourdomain.com or maps.yourotherdomain.org).

In the next two episodes, we'll look into casa.keru's "Suggest" and "Area" services. Stay tuned.

PS: Ah, yes, you are finally asking about the price tag. Integrating your properties into your web site is 100% free. All you need to do is register your access with us. Please contact felix@tredix.com for further information.

Links:

1. Get the Firebug Add-on: http://getfirebug.com/
2. Learn about jQuery: http://www.jquery.com
3. A brief intro to AJAX: http://en.wikipedia.org/wiki/Ajax_(programming)
4. Obtaining your Google Maps key: http://code.google.com/intl/en-EN/apis/maps/signup.html

Wednesday, January 5, 2011

CasaPortugal.de up and running in Germany

We have launched CasaPortugal.de in Germany.

Starting today, anybody trying to sell or rent his property with casa.keru will also advertise abroad, thus multiplicating circulation and reach.

CasaPortugal.de delivers the same content as casa.keru, making it the largest web site for Portuguese property in Germany right from the start.
 
Soon, there will be plenty more localized clones of casa.keru in all relevant European and overseas home buyers markets, driving lots of traffic and attention to the listings on the platform.

For our clients, this is great news: Simply list your property on casa.keru once, and it will automatically get local exposure in a growing number of foreign buyers' native countries!

Saturday, January 1, 2011

casa.keru press coverage in "Entdecken Sie Algarve"

Now that was a pretty nice new year's surprise:

casa.keru made it into the January issue of Southern Portugals leading German magazine "Entdecken Sie Algarve" (ESA).

Bernd Keiner wrote a very laudatory full pager praising the maps based search approach of the portal - thank you very much, Bernd!

We knew there was some press coverage in the works, but we didn't expect to even get a plug on the title! Apart from that, we were initially told the article wouldn't get published before February ... sooo glad we got the beta online on time.

Ever since, traffic is constantly increasing, mostly originating from Portuguese and German speaking countries. Also, we experience a growing demand for publishing properties for sale on our platform.

Again, thanks to all our friends over in the editorial department of ESA. Keep up the good work and stop by at the Tredix Cube for a drink or two any time.