[OpenLayers-Users] Re: [OpenLayers-Dev] OpenLayers.Projection(OpenLayers.Util.getElement(......).value) - jQuery problem

Troy Coburn troy.coburn at caris.com
Fri Sep 30 07:31:25 EDT 2011


Did you run the noConflict function?

http://api.jquery.com/jQuery.noConflict/

    <script type="text/javascript" src="other_lib.js"></script>
    <script type="text/javascript" src="jquery.js"></script>
    <script type="text/javascript">
      $.noConflict();
      // Code that uses other library's $ can follow here.
    </script>


Troy


Noli Sicad wrote:
> Hi,
>
> I am having problem executing this updateFormats function (below)
> which contains (OpenLayers.Util.getElement(......).value) in my jQuery
> mobile OL. The updateFormats is demonstrated in vector formats, in
> projection and out projection. My select controls are getting back
> when I clicked it.
>
> http://openlayers.org/dev/examples/vector-formats.html
>
> It seems that the problem is probably in the
> OpenLayers.Util.getElement(......) which a $.
>
> In Util.js,
>
> ~~~~~~~~
> OpenLayers.Util.isElement = function(o) {
>     return !!(o && o.nodeType === 1);
> };
>
> /**
>  * Maintain existing definition of $.
>  */
> if(typeof window.$  === "undefined") {
>     window.$ = OpenLayers.Util.getElement;
> }
> ~~~~~~~~
>
> Is this intervening in jQuery? Could I delete this? What would be the
> solution inorder that updateFormats will be executed properly?
>
> Thanks in advance.
>
> Regards, Noli
>
> ~~~~~~~~~~~~~~~~~~~~~~~
>
> This updateFormats in jQuery.
>
>
> #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> $(function() {
>
>   function updateFormats() {
>
>               alert("updated!");
>
> 			var in_options = {
>                 'internalProjection': map.baseLayer.projection,
>                 'externalProjection': new
> OpenLayers.Projection(OpenLayers.Util.getElement("inproj").value)
>
>
>             };
>             alert(in_options);
>             var out_options = {
>                 'internalProjection': map.baseLayer.projection,
>                 'externalProjection': new
> OpenLayers.Projection(OpenLayers.Util.getElement("outproj").value)
>             };
>             var gmlOptions = {
>                 featureType: "feature",
>                 featureNS: "http://example.com/feature"
>             };
>             var gmlOptionsIn = OpenLayers.Util.extend(
>                 OpenLayers.Util.extend({}, gmlOptions),
>                 in_options
>             );
>             var gmlOptionsOut = OpenLayers.Util.extend(
>                 OpenLayers.Util.extend({}, gmlOptions),
>                 out_options
>             );
>
>             var kmlOptionsIn = OpenLayers.Util.extend(
>                 {extractStyles: true}, in_options);
>             formats = {
>               'in': {
>                 wkt: new OpenLayers.Format.WKT(in_options),
>                 geojson: new OpenLayers.Format.GeoJSON(in_options),
>                 gml2: new OpenLayers.Format.GML.v2(gmlOptionsIn),
>                 gml3: new OpenLayers.Format.GML.v3(gmlOptionsIn),
>                 kml: new OpenLayers.Format.KML(kmlOptionsIn)
>               },
>               'out': {
>                 wkt: new OpenLayers.Format.WKT(out_options),
>                 geojson: new OpenLayers.Format.GeoJSON(out_options),
>                 gml2: new OpenLayers.Format.GML.v2(gmlOptionsOut),
>                 gml3: new OpenLayers.Format.GML.v3(gmlOptionsOut),
>                 kml: new OpenLayers.Format.KML(out_options)
>               }
>             };
>           }
> 		
>          $('#inproj, #outproj').change(updateFormats);
>       }); // for the function
> _______________________________________________
> Dev mailing list
> Dev at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/openlayers-dev
>   

-- 
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