cityofasheville / simplicity-backend

Simplicty backend
MIT License
10 stars 1 forks source link

Create PostGIS based Locator Search #14

Open daveism opened 9 years ago

daveism commented 9 years ago

This should eliminate the need for anything ESRI and we can go with a Node - postgres/postGIS solution.

jgravois commented 9 years ago

sorry to just drop in on your repository, but i've been keeping an eye on it (as a maintainer of esri-leaflet) and i'm curious to know a little bit more about why you're interested in moving away from Esri entirely if you feel like sharing.

just my two cents, but i was hoping to pitch in and try and make this app configurable enough for other cities to stand up after publishing their own Esri geocoding services so i'm kind of bummed to see you are planning on phasing our stuff out.

daveism commented 9 years ago

happy you dropped in, that is why we put it on GitHub. We have not used ESRI leaflet a whole lot so I cannot speak to it. The three other points are on par with what we have been discussing. We structured the back-end to act as the a data cruncher. With the idea that we could pass it on to any API. The only part that does not meet this is the geocoding services. So just thinking about how we facilitate a geocoding like search with other API's like Socrata, CKAN, CivicData, or any other data API. PostGres seems reasonable, maybe something like this: https://github.com/pramsey/pgsql-addressing-dictionary

ajturner commented 9 years ago

@daveism I'm curious what you mean by a "geocoding like search"?

Do you mean "Search nearby 1001 Main St" would geoparse the address and then use that as a spatial intersect query? Or do you mean something else?

daveism commented 9 years ago

The code in this repository does all the spatial intersections with PostGIS SQL in advance so we do not need to do it at run time. We found it dramatically improves the performance of the front end. In fact, we found in usability tests that we had to add fake spinners to make it appear the app was working on something. - In several usability tests, users kept hitting the submit button and cursing, thinking nothing was happening. The spinners added one or two seconds, but in the next rounds of usability tests users commented on how fast the results came back. - mainly with crime and development.

This is what I meant by Geocoding like search: We use the Geocoding Service because of it's ability to do fuzzy search. A user can enter [st, street, str] and overcome for minor miss spellings/typos. This is really nice for getting results back to users, like myself, that are horrible at spelling and make a ton of typos.

HTH

jgravois commented 9 years ago

that's cool! i guess originally it seemed to me like it would be easiest to get rapid adoption from other City Government Esri customers by refactoring the code to make the dependency on a dedicated PostGIS instance optional (hoping the whole thing could be deployed using something like github pages) and just talk exclusively to live services.

that being said, i love the app the way its designed now. if you are interested in continuing to support the use of Esri geocoding services, i'd be interested in helping write documentation and seeing what could be done to the existing code to streamline the process for other cities interested in redeploying.

The only part that does not meet this is the geocoding services.

this is a tangent, and may be something you already know, but Esri Open Data is intended to be an option for spinning up RESTful services for the data which supports custom geocoding services as well.

carlyleec commented 9 years ago

@jgravois so what you're talking should be "mostly" possible within the current app. I recently changed the structure of the angular app to allow for frontend and backend configuration changes.

Check out simplicity.backend.config.js. Your can define the paths to your tables and stuff, but the most important part here is in the simplicityBackend factory, into which you can inject the simplicityArcGisRestApiAdapter and SIMPLICITY_ARCGIS_QUERIES as simplicityAdapter and QUERIES, respectively.

This allows you inject any backend adapter into the main app. All you have to do is provide a search method in your adapter (which in your case would be a composite geocoder), and then define queries using the sqlArray property for each topic in the app (the sqlArrays use keywords to inject data into the queries, and I haven't documented this at all). These queries could be spatial queries using the ArcGIS REST api. Here's the simplicityArcGisRestApiAdapter.

There are probably a bunch of gotchas in what I just outlined being as I haven't tried it yet.

carlyleec commented 9 years ago

I mean I haven't tried it for configurations other that what we currently have.

jgravois commented 9 years ago

There are probably a bunch of gotchas in what I just outlined being as I haven't tried it yet.

i'm not skurred. as long as you guys don't phase out Esri geocoding services entirely i'd really like to find another partner city to help guinea pig standing up Simplicity again. this would help us identify the pain points and write documentation / tweak code to make it more painless the next time.

cc/ @jmadans