opentraildata / OpenTrails-Mobile

A mobile application for viewing trail maps
MIT License
18 stars 8 forks source link

Rewrite Logic for Search...and potentially, other things as well. #159

Closed alanjosephwilliams closed 9 years ago

alanjosephwilliams commented 10 years ago

Pinging @jmoe

This is the most significant piece of development work required to get To The Trails released as a reference implementation of the Open Trail System Specification.

Old Spec Model, Current App Model

"Trailheads" are associated with "Named Trails", which are composed of "Trail Segments". Trail Segments are host to "use attributes".

The user interacts with "Trailheads". This is true on both the map—the only interactive feature is a "Trailhead", which when activate, has/can have multiple "Named Trails" you can carousel through.

When the user searches for "biking and equestrian trails", they are shown "Named Trails" ordered by the proximity of the associated "Trailhead" to the user's current location. Whether or not those "Named Trails" show up in the search results is based on whether all of its "Trail Segments" have 'true' flags on their "biking" and "equestrian" properties.

This is complicated, and was a tradeoff made to accomodate data publishers. Turns out though, the tradeoff didn't hold up, and this setup was bad for publishers, too.

Current Spec Model, Future/Required App Model

Thus, the latest v1.1 of the Open Trail System Specification is different.

"Trailheads" are now associated with "Trail Segments", which are in turn referenced by "Named Trails".

When a user interacts with a "Trailhead", we will want to include all the "Named Trails" associated with each "Trail Segment" the Trailhead is directly associated with.

When a user searches for "biking and equestrian", we will want to show all "Named Trails" that are composed of an array of "Trail Segments" where each segment has a "true" flag for both its "biking" and "equestrian" properties. We will want to order those by the proximity of the nearest "Trailhead" associated with the nearest "Trail Segment".

JoaquinCardozo commented 10 years ago

@alanjosephwilliams Alan, It seems that we are not obtaining the information about what trail segments are associated with a trailhead.

On the webservice, for a given trailhead we see this:

"trailIds":[ 921, 877 ],

Which is fine for the current search, but cannot be used for the new requirements. Should we wait for the new API in order to do this? (Ticket #154 )

jmoe commented 10 years ago

There is some up to data available on OuterSpatial for Cleveland Metro Parks

http://www.outerspatial.com/organizations/cleveland-metro-parks/opentrails/stewards.csv

http://www.outerspatial.com/organizations/cleveland-metro-parks/opentrails/named_trails.csv

http://www.outerspatial.com/organizations/cleveland-metro-parks/opentrails/trail_segments.geojson

http://www.outerspatial.com/organizations/cleveland-metro-parks/opentrails/trailheads.geojson

I will still be providing API docs for list organizations and retrieving OpenTrails endpoints, hopefully tomorrow. :-)

jmoe commented 10 years ago

http://www.outerspatial.com/organizations/cleveland-metro-parks/opentrails/stewards.json

http://www.outerspatial.com/organizations/cleveland-metro-parks/opentrails/named_trails.json

Are JSON versions of the csv files.

JoaquinCardozo commented 10 years ago

@jmoe, @alanjosephwilliams I am having some problems with the new models. I've changed the endpoints and some attributes on the definitions of the models, and now I get an error on the Leaflet library. This is the error message:

TypeError: Cannot read property 'lat' of undefined at Object.o.LatLngBounds.intersects (http://localhost:8000/ios/www/js/lib/leaflet/leaflet.js:6:16794) at null. (http://localhost:8000/ios/www/js/application/TrailsCanvasLayer.js:92:39)

I'm not sure what is the problem, maybe some of you know something about it...

jmoe commented 10 years ago

Hey @JoaquinCardozo I am pretty far along with migrating the models over. I hadn't heard anything from you in a couple of days so I wasn't sure what was going. I will push my branch up and you can see how far along I am. I've got TrailSegments and Trails moved over and now I'm working on Trailheads. Let's sync on Monday morning.

JoaquinCardozo commented 10 years ago

Hey @jmoe , let me know if you have something new to push.

We are already reading the CSV, converting into models, and fixed some issues that came up (this is on the PR that was merged 3 days ago).

After that we had some problems like the one that I sent. I saw that you worked over the weekend. I will sync with your latest commits and see where you are at.

Thanks, Joaquin

jmoe commented 10 years ago

Yeah, I made lots of progress over the last week. Let's do a standup today at 9 to catchup.

jmoe commented 10 years ago

I've pushed a ton of stuff to the development branch. So please check that out and merge rebase your feature branch. Let's chat on slack as well. Can you join there?

jmoe commented 10 years ago

I need to implement the CSV endpoints in the API, so right now we are doing all JSON.

JoaquinCardozo commented 10 years ago

Yes, I will be there at 9. I am checking your commits right now.

jmoe commented 10 years ago

So, it seems like this all working for now! Anything to report @JoaquinCardozo