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

Nicholas Efremov-Kendall n.e.kendall at gmail.com
Sat Jun 25 19:17:22 EDT 2011


Sorry, Noli, I just knew that the $ was a common conflict between jQuery and
prototype, and to get them to behave together you had to use the noconflict
function...

On Sat, Jun 25, 2011 at 6:12 PM, Noli Sicad <nsicad at gmail.com> wrote:

> I think the jQuery no conflict function could not be apply in this
> case, since I am using jQuery mobile framework + Scrollview extension.
>
> http://jquerymobile.com/
>
> Just image changing all the $ to $j in jQuery Mobile framework, just
> to make   (OpenLayers.Util.getElement("inproj").value) working,
>
> var $j = jQuery.noConflict();
>
> Any other possible solution to get Util.js working in jQuery mobile.
>
> Noli
>
> On 6/25/11, Noli Sicad <nsicad at gmail.com> wrote:
> > Thanks Nick for this info.
> >
> > Now, I have to replace $ into $j,
> >
> > var $j = jQuery.noConflict();
> >
> > I will try this option and see what happen.
> >
> > Now, how extended the use of prototype in OpenLayers?
> >
> > Is only Util.js uses prototype.js in OpenLayers?
> >
> > I saw OpenLayers.mobile.js uses as well Prototype.
> >
> > Noli
> >
> > On 6/25/11, Nick Kendall <n.e.kendall at gmail.com> wrote:
> >> Try the jquery no conflict function
> >>
> >> http://docs.jquery.com/Using_jQuery_with_Other_Libraries
> >>
> >> Sent from my mobile device
> >>
> >> On Jun 24, 2011, at 8:23 PM, Noli Sicad <nsicad at gmail.com> 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
> >>> _______________________________________________
> >>> Users mailing list
> >>> Users at lists.osgeo.org
> >>> http://lists.osgeo.org/mailman/listinfo/openlayers-users
> >>
> >
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-users/attachments/20110625/2d703cb0/attachment.html


More information about the Users mailing list