finished php and tpl for geo analysis