Discuss "Notes from discussion about 'How location, mapping, and geo stuff' would be if it were done properly from scratch

Events happening in the community are now at Drupal community events on www.drupal.org.
Bevan's picture

Discuss this wiki page titled Notes from discussion about 'How location, mapping, and geo stuff' would be if it were done properly from scratch

Pulled form wiki page:

raintonr: Actually, I have created a module (implementing a CCK type) that at the moment is storing sets of points entered in "a1,b1,...n1 a2,b2,...n2" sets. Each point must hold at least a relative distance from start. Altitude, latitude/Longitude and userdata are optional. Lat/lon are strangely optional, but did this for people who have a cycle computer for instance that only records distance and altitude - they can still use the CCK field to store and plot this data. I have the idea that userdata can be things like speed, heart rate, cadence, time, etc, etc. At the moment there is a formatter to plot distance/altitude graphs. It can normalise data to show multiple fields/nodes on the same graph if required. Adding userdata to the graphing capability is high on the list. No map is shown at the moment, although a KML export (see below) will make inclusion of Google Map trivial.

There will be a second field type that will store derived statistics from the first. Things like total distance, max speed, average gradient, etc. Such stats have to be in separate fields to be used in views (well - to use in view and avoid too many formatters anyhow).

I didn't see the need to have something to store single points - users can enter nodes at specific locations using current location functionality of course.

With the above, the KML module can be extended to include paths entered into this type of field.

I planned to have KML/GPX/CRS/HST (CRS & HST are Garmin course/history exports) import at some point (at the moment am creating the arbitrary sets of numbers required with a perl script). Other functionality that is here now though, is the ability to extract data sets from existing fields and have created a graphical JavaScript pop up for this. This allows trimming of a current node. Joining/cutting/adding from/into nodes could also be done with a similar tool without too much bother.

How this can be used is: when a user wants sets of points in a path though they can create a node type using the above CCK fields. As many derived fields as are required can be added. In fact, maybe the derivation module should have hooks so that it can be extended. Ie, someone stores userdata set of 'foo' they create a module that knows how to average 'foo' and how to work out some other stat based on 'foo' and distance.

Your idea of using WKT is interesting, but it seems to go beyond what we are looking for. For example, to just draw a graph of distance/altitude. WKT seems to be able to input many points and paths in a single field (or node) so in that case how could you relate these?

Sorry for the long edit, good ideas. I hope to have my code ready for general consumption and a demo very soon.


Grugnog: not sure if these should really each be separate projects - there are a LOT of countries in the world, and a lot of sites really want anyone in the world to be able to enter an address! Is there not a more lightweight setup that could be used (e.g. .inc files)?

Comments

Almost There

raintonr's picture

Further to my comments, development on the 'trackfield' module is coming along nicely. Modules that are so far pretty much done:

  • trackfield - the underlying data storage field for distance/co-ordinate data. This had a built in parser to handle CSV data but am pulling that out and making it hook based so modules to parse different input can be written without change here.
  • trackfield_simplecsv - Parser to allow entry of data in simple CSV lists. Eg. a1,b1...x1 ... an,bn...xn
  • trackfield_graph - a field with no data entry widget that graphs data from a trackfield.
  • trackfield_map - a field with no data entry widget that uses the gmap module to display tracks.
  • trackfield_select - implements a javascript popup window to allow trackfield data to be copied from all/part of an existing field.

This is quiet early in the development piece so data validation, etc. probably isn't what it could be and things are a little rough. Overall though am happy with how it's going.

I'd like to release this code and have applied for a Drupal.org CSV account to do so.

ToDo

Well, plenty, but these spring to mind:

  • trackfield_stats - a field that calculates and displays various statistic from a trackfield. Actually, this will also allow user input of statistics for a track without points (for people who know it's 10 miles from A to B but don't have the GPS co-ordinates for that trip).
  • Userdata - ability to store userdata at each point. Things like heart rate, speed, cadence, etc, etc. The underlying database structure is there for this, but needs using. Of course the graph/stats modules will have to know how to use these.
  • Proper optimisation for gmap tracks - As gmap doesn't like hundreds of points track data is reduced to accommodate. At the moment this means simply removing 9 out of every 10 points. Hardly intelligent, this needs fixing.
  • gmap zoom - autozoom doesn't work for tracks, some way round this needs to be found.
  • Select popup - the blocks/header/footer/etc. need to be removed from the select popup window without having to resort to theme changes.
  • Select popup - make the display of graph/gmap/both configurable. Move markers around on gmap with sliders.
  • File import - allow users to attach files to nodes as they would any other, then extract co-ordinate data from these. Handle GPX, CRS, KML, etc, etc.
  • Configuration - allow site admins to configure sizes and other parameters for maps & graphs.

Location and Mapping

Group organizers

Group categories

Wiki type

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds: