[OpenLayers-Users] OpenLayers, syntax issue.

Troy Coburn troy.coburn at caris.com
Thu Nov 24 14:57:21 EST 2011


My bad on this, it can be passed in a a full object literal. Not 
something I usually do when creating a map.

Troy

On 11/24/2011 15:27 PM, Troy Coburn wrote:
> If you look at the OpenLayers.Map constructor it is asking for two 
> parameters; the first being the "div" to render the map, and the 
> second being a list of options. By using
> new OpenLayers.Map({div: "map", controls: [geolocate], layers:
> [layer]});
> You are actually passing in an object literal as the first parameter 
> where OL is expecting a div id reference.
>
>
> Troy
>
>
> On 11/24/2011 15:21 PM, jns wrote:
>> Hi,
>>
>> I apologize if this isn't the correct forum for my sort of question. But I'm
>> very new to this and I will however give it a try.
>>
>> This line of code will render the map just as it is supposed to do:
>>
>> map = new OpenLayers.Map({div: "map", controls: [geolocate], layers:
>> [layer]});
>>
>> ... but shouldn't the following lines give me the same result?
>>
>> map = new OpenLayers.Map("map");
>> map.addControl(geolocate);
>> map.addLayer(layer);
>>
>> I thought they were equivalent to the above statement, but apparently not
>> since no map is rendered. I use jQuery Mobile if it may make any differences
>>
>> Thanks,
>> Jonas
>>
>> --
>> View this message in context:http://osgeo-org.1803224.n2.nabble.com/OpenLayers-syntax-issue-tp7029250p7029250.html
>> Sent from the OpenLayers Users mailing list archive at Nabble.com.
>> _______________________________________________
>> Users mailing list
>> Users at lists.osgeo.org
>> http://lists.osgeo.org/mailman/listinfo/openlayers-users
>
> -- 
> Troy Coburn
> Web Developer
> CARIS <http://www.caris.com>
> 115 Waggoners Lane
> Fredericton, New Brunswick
> Canada    E3B 2L4
> Tel: +1.506.458.8533     Fax: +1.506.459.3849
> www.caris.com <http://www.caris.com>
>
> *Join us for CARIS 2012 --- Exploration and Discovery*
> June 25--28, 2012, Vancouver, British Columbia, Canada
> Visit www.caris.com/caris2012 <http://www.caris.com/caris2012> for 
> details today
>
> *Connect with CARIS*
> Twitter <http://www.twitter.com/CARIS_GIS> LinkedIn 
> <http://www.linkedin.com/groups?mostPopular=&gid=3217878> FaceBook 
> <http://www.facebook.com/pages/CARIS-The-Marine-GIS-Experts/123907500987669?v=app_4949752878> 
> YouTube <http://www.youtube.com/user/CARISGIS>
>
> Download your free copy of CARIS Easy View today!
> www.caris.com/easyview <http://www.caris.com/easyview>
>
> _________________________________________________________________________
> This email and any files transmitted with it are confidential and 
> intended only for the addressee(s). If you are not the intended 
> recipient(s) please notify us by email reply. You should not use, 
> disclose, distribute or copy this communication if received in error.
>
> Any views or opinions expressed in this email are solely those of the 
> author and do not necessarily represent those of the company. No 
> binding contract will result from this email until such time as a 
> written document is signed on behalf of the company.
>
>
>
> _______________________________________________
> Users mailing list
> Users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/openlayers-users

-- 
Troy Coburn
Web Developer
CARIS <http://www.caris.com>
115 Waggoners Lane
Fredericton, New Brunswick
Canada    E3B 2L4
Tel: +1.506.458.8533     Fax: +1.506.459.3849
www.caris.com <http://www.caris.com>

*Join us for CARIS 2012 --- Exploration and Discovery*
June 25--28, 2012, Vancouver, British Columbia, Canada
Visit www.caris.com/caris2012 <http://www.caris.com/caris2012> for 
details today

*Connect with CARIS*
Twitter <http://www.twitter.com/CARIS_GIS> LinkedIn 
<http://www.linkedin.com/groups?mostPopular=&gid=3217878> FaceBook 
<http://www.facebook.com/pages/CARIS-The-Marine-GIS-Experts/123907500987669?v=app_4949752878> 
YouTube <http://www.youtube.com/user/CARISGIS>

Download your free copy of CARIS Easy View today!
www.caris.com/easyview <http://www.caris.com/easyview>

_________________________________________________________________________
This email and any files transmitted with it are confidential and 
intended only for the addressee(s). If you are not the intended 
recipient(s) please notify us by email reply. You should not use, 
disclose, distribute or copy this communication if received in error.

Any views or opinions expressed in this email are solely those of the 
author and do not necessarily represent those of the company. No binding 
contract will result from this email until such time as a written 
document is signed on behalf of the company.

-------------- next part --------------
Skipped content of type multipart/related


More information about the Users mailing list