Select to view content in your preferred language

enter address but zoom to polling place

4470
18
12-10-2010 11:11 AM
by Anonymous User
Not applicable
Original User: alnesbit

Hello everyone,

I currently have my flex map from the viewer 2.1 set up to get to a polling place in a 2 step process. First the user enters their address in my locate widget. It zooms to their address. On the map is the name of their precinct (labels on the precinct polygon). Then in the search box they enter their precinct number and then they click on the polling location that shows up in the search results and it zooms to the polling place point.

Is there any possible way to make this one step? Where the user enters their address and it automatically goes to the polling location?

I'm having trouble thinking of how this would work. Appreciate any help,
0 Kudos
18 Replies
by Anonymous User
Not applicable
Original User: alnesbit

Robert,

Sorry for the delay - I've been working with this since you gave it to me. THANK YOU SO MUCH!! It works great!

I have inspected the heck out of this code and it's very, very close. I copied and pasted the infowindow so that it shows on the polling place right away before clicking on the address point or the row in the grid.

I also played around with the extent and the center map. I think they want it to go right to the polling place without showing the address point, necessarily. So I changed it to do that.

The things I'm trying to learn in a hurry now are how create a more advanced looking page - layout, text. I think it's works just fine but I know the first thing they will say is "this doesn't Look very good". So I've been reading like crazy in these flex books and online.

I'm also having a huge problem because the first thing I showed them was the flex viewer with widgets. So now I'm baffled as to how to take this fully functional application and turn it into a widget for the flex viewer instead. I was about to formulate another forum question to this effect. The flex viewer is just really confusing code for the beginner and there's no real guidance on how to create your own widget on the resource center.

Thank you!
0 Kudos
by Anonymous User
Not applicable
Original User: alnesbit

Just wanted to say I have the app working and I have it also looking great! I was able to figure out how to do some design work.

Thank you!
0 Kudos
RobertScheitlin__GISP
MVP Emeritus
Andrea,

   That's good news. Is your application publicly accessible?
0 Kudos
by Anonymous User
Not applicable
Original User: alnesbit

Robert,

Yes, it is. I will say, though, that it's on the client's server and it is really sssslooooow. It takes forever for the map part to load. And actually this morning, the map doesn't load at all. hmmm. I know part of the reason it's so slow is the aerials, which are not cached but don't turn on until you zoom in. But also I think their server is just slower in general. Oh and also I renamed the html file to "index.html" and it says it should load as the default, but it won't and you still have to put /index.html, not sure why.

check it out http://66.119.8.142/christiancoclerk/index.html
0 Kudos
RobertScheitlin__GISP
MVP Emeritus
Andrea,

    The index issue is most likely if you are using IIS that index.htm is part of the default document types but index.html is not. Looks good the only thing that is a draw back for me is the size of the map. But that is because I am use to the map being the focal point.
0 Kudos
by Anonymous User
Not applicable
Original User: alnesbit

Robert,

Thanks. Yeah, exactly. Believe it or not I tried to make the map as big as I could. But I still had to fit in all the instructions about how to use the site, the address input button, the links at the top and the banner. You should have seen it with the original banner size, it was quite funny how small the map was.
0 Kudos
by Anonymous User
Not applicable
Original User: alnesbit

Hi Robert,

Well, the client didn't like it. She wanted it just like another website that she had seen. So I changed the layout and colors and etc. Check it out http://66.119.8.142/christiancoclerk/

I also fixed the "index.html" thing, thanks.

I have a few new questions for you if you're not too annoyed and have time.

1) Do you know if I can make the grid go down vertically? For instance, have the Address, then below it the cell for the Geocode Score, then below that the cell for the Polling Place? I looked around but didn't see a property like that.

2) What code do I need to add so the user can hit Enter on their keyboard and not have to click on the "Locate" button?

3) Do you have any idea how I could put a scroll bar on the side of this whole application, like a normal webpage? I've tried it several different ways and it always messes up the layout somehow and doesn't add a scroll bar.

Thanks a million!
0 Kudos
RobertScheitlin__GISP
MVP Emeritus
Andrea,

1. I have not seen any ability to do that with a datagrid but you could use a datagroup and an custom itemrenderer.
2. Add these lines to the init function: (document.getElementById('Andrea').focus(); 'Andrea' has to be replaced with your applications name i.e. the name of the main.mxml.
    navigateToURL(new URLRequest("javascript: document.getElementById('Andrea').focus();"), "_self");
    //Now give the focus to the first input
    inCity.setFocus();

and change this line:
<s:TextInput id="inCity" text="Billings" enter="locate()" />

3.
 <s:Scroller height="100%" width="100%">
  <s:Group>
   <mx:VDividedBox height="800" width="100%">
    <s:VGroup height="100%" width="100%">
     <mx:Image source="assets/images/newheader.jpg"/>
     <s:Label text="    Step 1:  Enter the address that you are intrested in below. Then Click Locate."/>
     <s:HGroup verticalAlign="middle">
      <s:Label text="    Address:"/>
      <s:TextInput id="inAddress" text="306 Washington" />
      <s:Label text="City:"/>
      <s:TextInput id="inCity" text="Billings" />
      <s:Button id="locateBtn" label="Locate..." click="locate()"/>
     </s:HGroup>
     <s:Label text="    Step 2: Click on a row in the grid to get details on the location. The Geocode Score is a percent of how closely your address matches the address listed." />
     <esri:Map id="map" zoomSliderVisible="false" height="100%">
      <esri:ArcGISDynamicMapServiceLayer 
       url="http://gis-server.greatriv.com/ArcGIS/rest/services/ChristianCo/ChristianCo_Clerk/MapServer"/>
      <layers:GraphicsLayer id="graphicsLayer" graphicProvider="{queryTask2.executeLastResult.features}" symbol="{pollSym}"/>     
     </esri:Map>
    </s:VGroup>
    <mx:DataGrid id="resultsGrid" itemClick="onItemClick(event)" width="100%" height="87">
     <mx:columns>
      <mx:DataGridColumn headerText="Id" dataField="id" visible="false"/>
      <mx:DataGridColumn headerText="Address" dataField="address"/>
      <mx:DataGridColumn headerText="Geocode Score" dataField="score"/>
      <mx:DataGridColumn headerText="Polling Place" dataField="polling"/>
     </mx:columns>
    </mx:DataGrid>
   </mx:VDividedBox>
  </s:Group>
 </s:Scroller>
0 Kudos
by Anonymous User
Not applicable
Original User: alnesbit

Robert,

Thank you so much! My trial version of Flash Builder ran out, lol! So I have to wait until next week when it arrives in the mail and I get it installed before I can try out your code. I will keep you posted...as always! 🙂

Happy Valentines Day! Just think, if everyone who you helped sent you flowers or candy today, your desk would be overflowing!!!

Thanks again,
0 Kudos