Adding a New Feature: Lines and Areas on Maps?

We encourage users to post events happening in the community to the community events group on https://www.drupal.org.
tom_o_t's picture

I'd like to allow people to add lines (e.g. bike paths, walking routes) and areas (e.g. parks, forests, polluted areas) and have these display alongside points using gmap_views.

I've had a look around the Location and Mapping group discussion, the GMap issue queue, the various other mapping modules (GMap Addons, Geo, GeoBrowser, OpenLayers) and haven't found any development being done on this.

I know that the GMap Macro lets people add lines and circles, but from what I can find there's no way to associate a line or polyshape with a node in the same way that there is for a single lat/long.

So two questions:

  1. Is anyone else working on this?
  2. Would someone be able to give me a little guidance on how to start adding this functionality to GMaps, I guess via GMap Addons?

I'm developing this for the non-profit Green Map System, to make a website where people can map all things sustainable in their neighborhood. A very early proof of concept is at http://www.greenmap.org/ogm

I would love to be able to get these features added and contributed straight back to the Drupal community...

Comments

CCK Map Path/POI Types?

raintonr's picture

Interestingly I was pondering something very similar this weekend.

At the moment am using location API with some EXIF hacks (see http://drupal.org/node/178370) to fill image locations automatically. Then use the KML module with a patch to show different icons on a per-content type basis (see http://drupal.org/node/181048) and other theming mods (see http://drupal.org/node/180668). The outcome of all this is that the KML module can make nice files for Google Earth/Maps with some content types appear as stars and images as small camera icons with thumbnail and link when clicked.

To extend this further was thinking that if paths (your area is just a closed path with fill attribute) and other icons (points of interest) could be saved as nodes then all our KML files could be automatically generated.

The logical way to do this (well one way) would be to introduce a couple (or more?) content types:

  1. A point of interest. Just a small description (or variation of an image if you want a picture) with different icon in the KML feed.

  2. A path (or area).

Point 1. could actually be done right now - it's just a new content type with simple fields and location information enabled.

Point 2. is more tricky. I believe one should introduce a new CCK field type - "Map Path" (or whatever you want to call it). To begin this could be edited with a text entry box as a list of co-ordinates in "lat,lon,alt lat,lon,alt ... lat,lon,alt", or "lat,lon lat,lon ..." if altitude is not needed. Once stashed in the DB, the KML module would include this in any output required. You could also have the GMAP module modified to know how to render this CCK type.

Later on one could replace the text entry box widget with a fancier interactive path drawing widget if required.

Does that make sense? Sound feasible? Something we could progress?

CCK Track

raintonr's picture

Further to the idea of a "Map Path" CCK, I have been working on this and created a prototype.

Actually, this all started to give the ability to draw graphs of vertical climb/descent of various routes so I created a 'vertical profile' CCk type, with data input as pairs of distance/altitude.

To extend this I intend to change the input widget to allow the following entry:

  • Distance/Altitude pairs
  • Lat/Lon pairs
  • Lat/Lon/Altitude triple
  • Lat/Lon/Altitude/a1/a2.... where a1, etc. are arbitrary data values. Athletes could use this for heart rate for instance, cyclists for speed & candence, etc, etc.

For the formatter I already have graphs of the distance/vertical working using jpgraph[1] and intend to add other options that include vertical/map pair or each alone. For arbitrary values one could graph them too.

Part of our requirement is to allow one track to be split into sections and have also been working on a graphical Javascript page for this. It has sliders from WebFX and uses Walter Zorn JavaScript VectorGraphics library to show where these sliders are over the graph above. Although maybe in the future a change could be made to use the WebFX chart widget[4] (which itself uses the Zorn library already mentioned).

Does this sound useful to anyone?

Robin

[1] http://www.aditus.nu/jpgraph/
[2] http://webfx.eae.net/dhtml/slider/slider.html
[3] http://www.walterzorn.com/jsgraphics/jsgraphics_e.htm
[4] http://webfx.eae.net/dhtml/chart/chart.html

Location and Mapping

Group organizers

Group categories

Wiki type

Group notifications

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