Select to view content in your preferred language

Zillow Widget for Flexviewer 2.x

2574
11
02-02-2011 01:12 PM
ReneRubalcava
Esri Frequent Contributor
Not too long ago someone had inquired about a Real Estate widget using Zillow or some other service on this forum.

So, I had been wanting to try out some new API's and built a Zillow Widget for Flexviewer 2.x.
http://www.arcgis.com/home/item.html?id=43a861b27c3a4463b23493d042974138

You will need to get your own Zillow API key from Zillow, which you can do for free.
http://www.zillow.com/howto/api/APIOverview.htm

Their API calls are pretty well documented and it's basically a lot of XML parsing. This widget was also built using Robotlegs once I realized that it was really going to be a more invloved module than I initially anticipated.
If you wish to compile from source, you will need the Robotlegs .swc file which you can get from the official site.
http://www.robotlegs.org/

I have tested some more extensive API calls to Zillow and I am pleasantly surprised that their servies are quick. You are limited to 1000 API calls per day, so if my sample application breaks, that is probably why.

The latest source can be found on github
https://github.com/odoe/Zillow-Widget

I will update the zip file on the Resource center when new functionalities are complete. The github repo will probably have some incomplete features as I commit often while working.

Any feedback is welcome, thank you.

Update:
(02/03/2011) - added search options for Regional Postings to include Property Types and Rentals.
Tags (2)
0 Kudos
11 Replies
JamesHolley
Emerging Contributor
I am interested in using the zillow widget, in my companies web app.  The problem that I am running into is all of our data is projected in state plane, and the returned results are not.  Any help with this would be great.

Thanks,
James
0 Kudos
ReneRubalcava
Esri Frequent Contributor
I wrote a utility class to process Zillow Results and turn them in to graphics.
https://github.com/odoe/Zillow-Widget/blob/master/main/util/ZillowUtil.as

If you look at the results, it returns a lat/long coordinate.

var wgs:MapPoint = new MapPoint(attr.longitude, attr.latitude, new SpatialReference(4326));
var mp:MapPoint = WebMercatorUtil.geographicToWebMercator(wgs) as MapPoint;


You'd need to send the results to a geometry service to reproject them. There's no easy way to reproject data clientside in Flex.
0 Kudos
JamesHolley
Emerging Contributor
I am also having trouble compiling the widget, ui:ViewManager is causing an error.  If you have any advice, it would be great.  Thanks

Error 1046: Type was not found or was not a compile-time constant:
0 Kudos
ReneRubalcava
Esri Frequent Contributor
To use the Zillow widget, make sure you have downloaded the Robotlegs swc and added it to your Flexviewer libs folder.
http://www.robotlegs.org/

That might be the issue. I just tried it out in FV 2.3 and it's working ok.
If you get more errors, could you post the full console output of the error?
0 Kudos
JamesHolley
Emerging Contributor
I downloaded and added the robotlegs.swc to the lib folder, and I am still getting the same error.


1046: Type was not found or was not a compile-time constant: ViewManager. line 34 ZillowWidget.mxml /flexviewer-2.3.1-src/src/widgets/Zillow/source/main Flex Problem


I am not sure if this tells you anything more, but I would like to thank you for your help and quick response.
0 Kudos
ReneRubalcava
Esri Frequent Contributor
Does you ZillowWidget.mxml file look like this?
<?xml version="1.0" encoding="utf-8"?>
<viewer:BaseWidget xmlns:fx="http://ns.adobe.com/mxml/2009"
       xmlns:s="library://ns.adobe.com/flex/spark"
       xmlns:mx="library://ns.adobe.com/flex/mx"
       xmlns:viewer="com.esri.viewer.*"
       xmlns:main="widgets.Zillow.main.*"
       xmlns:ui="widgets.Zillow.main.view.ui.*"
       layout="absolute"
       widgetConfigLoaded="basewidget_widgetConfigLoadedHandler(event)">
 <fx:Declarations>
  <main:ZillowContext contextView="{this}" />
 </fx:Declarations>
 <fx:Script>
  <![CDATA[
            
   protected function basewidget_widgetConfigLoadedHandler(event:Event):void
   {
                if (configXML)
                {
                    var zwsid:String = configXML.zwsid;
                    vManager.zwsid = zwsid;
                    vManager.map = map;
                }
   }
  ]]>
 </fx:Script>
 <fx:Style source="assets/zillowwidget.css" />
 <viewer:WidgetTemplate id="wTemplate"
         width="300"
         height="315"
         minHeight="315"
         minWidth="300">
  <ui:ViewManager id="vManager"
      width="100%"
      height="100%" />
 </viewer:WidgetTemplate>
</viewer:BaseWidget>


Make sure you have the correct namespaces in the BaseWidget.
xmlns:main="widgets.Zillow.main.*"
xmlns:ui="widgets.Zillow.main.view.ui.*"
0 Kudos
JamesHolley
Emerging Contributor
That worked! The namespaces were a little off on my end.  Now that I have it up and going again I am back to my original problem of getting the widget to project in state plane. I have my wkid number which is wkid=3433 and a geometry service running on my server, but can not figure out how to modify your code to implement the action I need to take place.  Thanks again
0 Kudos
RyanColeman
Regular Contributor
is there a way of clearing the house graphics and infowindow when the widget closes? I tried a widgtetclosedhandler that clears the graphicslayer and infowindow in ZillowWidget.mxml but it does nothing probably because they don't connect to the actual stuff
0 Kudos
ReneRubalcava
Esri Frequent Contributor
Sorry, I have not had much free time to work on my widget projects.
I updated the Zillow widget with a clear button. I've found that users don't always want to clear results when a widget is closed, so I think this is a good compromise.

Now if you wanted to do this on widget close, I add a clear method to the ViewManager
vManager.clearLayer();
You can tie the widget close event to a function that can call this method when the widget is closed if you like.

Hope that helps.
0 Kudos