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: [email protected]
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 <[email protected]> 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: [email protected]http://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=...
>>>       
>>> 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
>>>       

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"SIMILE Widgets" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/simile-widgets?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to