mezerotm / cmv

CMV is a citySDK based map visualizatoin tool
5 stars 5 forks source link

Create a place for the user to enter in geographic information #26

Closed ravenusmc closed 7 years ago

ravenusmc commented 7 years ago

Currently, the app is only set to allow the user to look at geographic data for Gwinnett County. The app needs to be fixed to allow the user to see information anywhere in the country.

NJTuley commented 7 years ago

I think the plan for this is to put this input area in the top-most sidebar, right now it is empty and just needs to be filled with these input fields, or however we wanted to collect this input from the user

hardnett commented 7 years ago

We were talking about this is Gitter and I think the idea is to change the input box next to the submit button to accept: city, state, county, zip.

NJTuley commented 7 years ago

Do we have a way of validating the user input? I have found some javascript expressions to validate a zip code, but they do not validate that a given city, state, or county is valid, and if the zip code is syntactically valid, but is unassigned at the moment (for whatever reason), it would get past our validation.

hardnett commented 7 years ago

I agree. The validation is important. I think we can probably find JS standard code for validation. Is the primary query mechanism in City SDK predicated on Zip Code, County, and/or City name? I know that our current code is based on County. Suppose we start with just zipcode, and then extend it to city and county since a city and county may have more than one zip code. I'd like to see how this is done for tools like Google Maps, because you can start entering almost any location data and it will start to provide possibilities. Like if you start typing a city name is pulls up city and state combinations. I am not suggesting that we have to do it this way, but that there is probably a service we can leverage for validation.

If we were able to tap into this then I could see having a box for zip code, a box for city, and box for county, and a box for state. Our code will do a query with any or all entries. Part of the validation is that if we send in a query that gets no data then that is another form of validation.

NJTuley commented 7 years ago

I created a branch called Location_Input, and have been working with it to get the input for zip code working, and right now I have it to where it checks if the zip code entered by the user is syntactically correct (right number of digits and no letters or special characters etc.), but I am running into an error. When I put in some zip codes, it works and it outputs data from the given zip code (or the county that that zip code is in), but when I do others (this is what happens more often than not), I get an error, and it outputs the same set of polygons regardless of the zip code entered. I have a theory that this may be because the census records might use a different zip code system? Or they might have records for the year of the data we are looking for (right now 2014 is hardcoded in) that do not have the latest zip codes? Or some other disconnect between the zip codes that I was using (I googled gwinnett county, fulton county, macon, etc. zip codes and used them) and the zip codes that are in the citysdk database. That is just my theory after messing with it for the past few hours, so if anyone has any thoughts. I will also be looking at using another API or similar thing to lookup city and state from the zipcode, and hopefully to validate that the zip code exists and is current, but I have not had a chance to find or implement one yet. I pushed the most recent files to my branch (Location_Input) right now, if anyone wants to see.

hardnett commented 7 years ago

I see. okay, here is what you should try. go to the CitySDK site where we were first learning how to do queries and test those error prone zip codes there and see if you get the same results.

NJTuley commented 7 years ago

I came up with an idea (i cant test it today), the idea is to use a google api that i found that validates zip codes and etc, and can also retrieve city and state and county info from a zip, and use this to, when given a sip code, retrieve the city/state/county to display based on the detail level the user has selected, and use that county/state/city for the census request, because those change a lot less often than zip codes id think. Im going to test this either tonight or tomorrow, and ill let you know how it goes, wanted to let you know my idea though

mezerotm commented 7 years ago

We could maybe take advantage of Google Places API. They have what they call 'Places autocomplete' It's the same location search bar they use in their regular google map where you can insert location information like street address, city, state, zip etc. This then converts that information into coordinates we can easily just plug into the citySDK.

NJTuley commented 7 years ago

@MEzeroTM that wouldn't work as far as I understand the citysdk data requests. When we send it a request, our request needs to have a zip code, city, state, and/or county provided, not a single data point. I am going to be looking into the google places api to see if they have translation methods that would allow us to convert a zip code into a county/city/state, which we could send to the citysdk in our request. Zip codes are always associated with a county, city, and state, as long as they are valid (which I have code that should validate, I will test that when I implement the google place api). Main point for this response is that I don't believe we can use a single point returned from the google places API and plug it into the citysdk request

NJTuley commented 7 years ago

I have gotten the project working with the google places API (for the most part, minor fixes to make it more user friendly once I get it fully working), but right now I am running into an issue where it only works for certain zip codes (examples: 30024 and 31201), but not for others. I am currently waiting on a response from a citysdk guy about whether there is a known issue with certain zip codes? or if there is another related error. Will pick this issue back up actively when I hear back from him.

NJTuley commented 7 years ago

All functionality is completed, just need to merge this with the corresponding branches and we can close this issue as far as I am aware.