Is it possible to have an item that isn't filtered?

26 views
Skip to first unread message

Crabstix

unread,
Apr 11, 2009, 10:34:13 AM4/11/09
to SIMILE Widgets
Hi,

I've put together the following page for my band
http://www.joecrabtree.com/test/tour_stuff/Wishbonetour2.php?address=n5+1ba%2Cuk&submit=submit

It shows past and future gigs on a timeline and a map, and if you type
your address in the top left it plots you on the map too.

That's cool for seeing where you are in relation to the gigs but as
soon as you start filtering the results your pin disappears. I was
wondering if there was a way to leave an anchor pin on the map, or to
tell Exhibit not to filter a specific result.

Thanks,

Joe

John Callahan

unread,
Apr 11, 2009, 11:24:31 AM4/11/09
to simile-...@googlegroups.com
If you write your own javascript to add address locations to Google
Maps, I didn't think it would be included at all in the filtering? I
haven't tried it so I'm not sure if the Exhibit map code wipes out all
markers or just those that are part of the collection. Likely it's the
latter, in which case you should be OK. The GMap API should be loaded
the same as if you were creating a Google Maps application from scratch,
so you should be able to use the GM API functions as described in the
reference, http://code.google.com/apis/maps/documentation/reference.html

Here's a link to a geocoding example,
http://code.google.com/apis/maps/documentation/services.html#Geocoding_Object


Nice site. I love the sliders!

- John

**************************************************
John Callahan
Geospatial Application Developer
Delaware Geological Survey, University of Delaware
227 Academy St, Newark DE 19716-7501
Tel: (302) 831-3584
Email: john.c...@udel.edu
http://www.dgs.udel.edu
**************************************************

ksd

unread,
Apr 12, 2009, 9:48:19 AM4/12/09
to SIMILE Widgets
In case you don't have Javascript at your fingertips, you may try this
(near) solution:

Add an item that shows on the map (has coordinates) but has all the
possible values for
the selection facts.

It's a scrappy solution since the item counts will always appear one
more than they should be.

In the case of your "Country" facet, make it a field the duplicates
part of the address, but is not
linked to the mapping. Then your persistent item will be in all
visible if you select any country, but
have only one address.

On Apr 11, 7:34 am, Crabstix <joecrabt...@gmail.com> wrote:
> Hi,
>
> I've put together the following page for my bandhttp://www.joecrabtree.com/test/tour_stuff/Wishbonetour2.php?address=...

John Callahan

unread,
Apr 13, 2009, 12:58:00 AM4/13/09
to simile-...@googlegroups.com, Crabstix
Hi Joe,

I was incorrect in my thinking. After looking into it more, a few
thoughts...


You *could* use the mapConstructor function as defined in the Exhibit
MapView. First, identify your new mapConstructor function name:

ex:mapConstructor="newMapConstructor"

Then, add that function somewhere on your page, such as:

function newMapConstructor(mapDiv){
map = new GMap2(mapDiv);
map.setCenter(new GLatLng(39.823,-75.723), 10);
map.addControl(new GLargeMapControl());
return map;
}


You could modify the map as much as you want here. The argument passed
in here (mapDiv) is the div containing the map. It's created behind the
scenes so you can just make up a variable here. You can also write
functions that apply against the map. For example, If I want a user to
add a marker to the map (this could like a geocode), just create a link
or button on your page that refers to a function that would be similar
to below. Just use "map" as the Google Maps API map object.

function addMyMarker() {
var cpoint = new GLatLng(39.823,-75.723);
var cmarker = new GMarker(cpoint,{draggable: true});
map.addOverlay(cmarker);
}

However, adding markers this way does *NOT* keep them from being removed
when facets/filters are used. This is because the map reconstructor
function runs with every filter and clears all overlays from the map,
then adds back those selected. So, the best bet here is to override
that map reconstructor function. Taking a cue form
http://groups.google.com/group/simile-widgets/browse_thread/thread/d7c99ead4728c745/4f7c303b708f29a2?hl=en&lnk=gst&q=mapConstructor#,
you can do


<script type="text/javascript">
var oldReconstruct = Exhibit.MapView.prototype._reconstruct;

Exhibit.MapView.prototype._reconstruct = function() {
oldReconstruct.call(this);

var cpoint = new GLatLng(39.823,-75.723);
var cmarker = new GMarker(cpoint,{draggable: true});
this._map.addOverlay(cmarker);
};
</script>


The first few lines essentially copy the old reconstructor and replace
it. Map overlays added in this way do NOT get filtered with each facet
because that are explicitly added every time the map gets drawn. To
allow users to add points in this way (such as gecoding, routing), have
each point created by the user potted on the map AND saved to an array.
Then, make Exhibit.MapView.prototype._reconstruct cycle through that
array to add points. As the map gets redrawn with each filter, all user
added points will be included.


Hope this helps!

- John

**************************************************
John Callahan
Geospatial Application Developer
Delaware Geological Survey, University of Delaware
227 Academy St, Newark DE 19716-7501
Tel: (302) 831-3584
Email: john.c...@udel.edu
http://www.dgs.udel.edu
**************************************************


Crabstix wrote:
> Hi John.
>
> Thanks for taking the time to a look at my problem. I'm not very
> familiar with API stuff and OOP and things. I just play around and
> try and make things work.
>
> I tried adding the geocoding example from Google to my Exhibit script
> but I couldn't get it to work. From what I can make out I need to
> reference the map as an object and I don't know how Exhibit has that
> set up.
>
> I was hoping it would be a simple case of a couple of lines of
> Javascript along the lines of
>
> var marker = new GMarker('38.479394673276445,
> -115.361328125');
> map.addOverlay(marker);
>
>
> The google example has an initialization function which creates the
> map and then you obviously have a pointer to the object (not sure of
> the terminology).
> map = new GMap2(document.getElementById("map_canvas"));
>
> Since Exhibit has already created the map I don't know how to
> reference it. What do I need to use in place of 'map' in the
> statement - map.addOverlay(marker);?
>
> Any ideas?
>
> Thanks again for your help.
>
> Joe


>
>
>
> On Apr 11, 4:24 pm, John Callahan <john.calla...@UDel.Edu> wrote:
>
>> If you write your own javascript to add address locations to Google
>> Maps, I didn't think it would be included at all in the filtering? I
>> haven't tried it so I'm not sure if the Exhibit map code wipes out all
>> markers or just those that are part of the collection. Likely it's the
>> latter, in which case you should be OK. The GMap API should be loaded
>> the same as if you were creating a Google Maps application from scratch,
>> so you should be able to use the GM API functions as described in the

>> reference,http://code.google.com/apis/maps/documentation/reference.html
>>
>> Here's a link to a geocoding example,http://code.google.com/apis/maps/documentation/services.html#Geocodin...


>>
>> Nice site. I love the sliders!
>>
>> - John
>>
>> **************************************************
>> John Callahan
>> Geospatial Application Developer
>> Delaware Geological Survey, University of Delaware
>> 227 Academy St, Newark DE 19716-7501
>> Tel: (302) 831-3584

>> Email: john.calla...@udel.eduhttp://www.dgs.udel.edu
>> **************************************************
>>
>> Crabstixwrote:


>>
>>> Hi,
>>>
>>> I've put together the following page for my band

>>> http://www.joecrabtree.com/test/tour_stuff/Wishbonetour2.php?address=...

Crabstix

unread,
Apr 13, 2009, 6:57:07 PM4/13/09
to SIMILE Widgets
Brilliant!

Thank you so much.

Joe
> that map reconstructor function.  Taking a cue formhttp://groups.google.com/group/simile-widgets/browse_thread/thread/d7...,
> Email: john.calla...@udel.eduhttp://www.dgs.udel.edu
> **************************************************
>
> Crabstixwrote:
Reply all
Reply to author
Forward
0 new messages