[OpenLayers-Users] OpenLayers in Rails

staff-gmail john.staff2222 at gmail.com
Thu Oct 11 01:55:04 EDT 2007


angus scown wrote:
> staff-gmail wrote:
>> The control icons are not showing up in Rails - I have OpenLayers.js 
>> from the build directory in the Rails javascripts folder  and put the 
>> /img and /theme also within the javascripts folder but they are not 
>> being accessed correctly.  The control buttons seem to work okay - 
>> but the images don't show.  Anyone work around this ? 
>> _______________________________________________
>> Users mailing list
>> Users at openlayers.org
>> http://openlayers.org/mailman/listinfo/users
>>
>>   
> if you don't want to modify the openlayers javascript then you need to 
> place the /img folder in a folder with the controller name under the 
> public directory.
>
> i.e. /public/some-controller-name/img
> e.g /public/jobs/img
>

Michael Quentel wrote:
 > 
 > Try modifying the image path in Utils.js to what the Rails application
 > would use for the img and theme directories.
 >

thks - yeah, I saw that about the controller location.   Problem is if 
you use the map in more than 1 view, then you have the same image 
folders in multiple locations, not good though a hackable solution.   So 
it would be better to modify the Utils.js - I noticed that is available 
under the /libs directory so I guess that should be installed.   I'll 
play around with that (noting that Rails sees image mime types and goes 
to the /images folder so I think the location needs to be there).    It 
gets worse - if you have a background image in your map - Rails will see 
it as an image mime-type and look for it under /images.  If you have a 
kml file - Rails simply sees it as an external file and sees it under 
the /public folder.  And it gets worse if you have an SVG file, firefox 
wants to see it as an xml file type but Rails does something with the 
mime-type and I'm not sure what. 



More information about the Users mailing list