[Mapbender-users] Extract coordinates from a mapbender map

Christian Wygoda christian.wygoda at wheregroup.com
Thu Dec 19 01:27:29 PST 2013


Hi,

I prepared to fiddles for you:

http://jsfiddle.net/arsgeografica/qhU95/ Set's up a document with a
FooBar property of value 42.

http://jsfiddle.net/arsgeografica/Te7mX/ Embeds the first document in an
iframe and acccesses the FooBar property.

Hope that makes things clear.

Cheers,
  Christian

On Thu, 2013-12-19 at 10:29 +0200, Geoset Ltd wrote:
> OK. Well I think I meet the criteria. Same protocol, same host, same
> port. But I can get as far as the iframe Document. From there,
> whatever I try to do to access the map element doesn't seem to work.
> Any advice?
> 
> 
> 
> 2013/12/19 Christian Wygoda <christian.wygoda at wheregroup.com>
>         Hi,
>         
>         if your main document and the iframe document fulfill the
>         browser's same
>         origin policy, you're set to go, if not, expect trouble.
>         
>         See
>         https://developer.mozilla.org/en-US/docs/Web/JavaScript/Same_origin_policy_for_JavaScript for an explanation.
>         
>         Cheers,
>           Christian
>         
>         On Thu, 2013-12-19 at 09:30 +0200, Geoset Ltd wrote:
>         > Thanks a lot! But what do you mean at the end "If the iframe
>         and main
>         > document target different origins" ? The src of the iframe
>         doesn't
>         > point to another html page. It points to the map itself. The
>         link is
>         > the one of the Mapbender application.
>         >
>         >
>         >
>         > 2013/12/18 Christian Wygoda
>         <christian.wygoda at wheregroup.com>
>         >         Hi,
>         >
>         >         you will need to gain access to the iframe's window
>         object and
>         >         from
>         >         there use that window's jQuery object to gain access
>         to the
>         >         map like so:
>         >
>         >         // Code untested, so here be dragons:
>         >
>         >         var iframe = $('iframe').get(0);
>         >         var iwindow = iframe.contentWindow || iframe;
>         >         var mapDiv = iwindow.$('.mb-element-map')
>         >         var olMap = mapDiv.data('mapbenderMbMap').map.olMap;
>         >
>         >         Then, add a click listener to mapDiv and use the
>         olMap to
>         >         convert the
>         >         viewport click position to world coordinates. See
>         the
>         >         OpenLayer Map API
>         >         docs for that.
>         >
>         >         If the iframe and main document target different
>         origins, you
>         >         will
>         >         probably have trouble accessing them from each other
>         in
>         >         JavaScript
>         >         though.
>         >
>         >         Cheers,
>         >           Christian
>         >
>         >
>         >         On Tue, 2013-12-17 at 13:35 +0200, Geoset Ltd wrote:
>         >         > I'm using mapbender3
>         >         >
>         >         >
>         >         >
>         >         > 2013/12/17 Armin Retterath
>         <armin.retterath at gmail.com>
>         >         >         sorry - do you use mapbender3 or
>         mapbender2?
>         >         >
>         >         >
>         >         >
>         >         >
>         >         >         2013/12/17 Geoset Ltd <gsetit at gmail.com>
>         >         >                 Hello. I have a web application
>         and in it,
>         >         an iframe
>         >         >                 with a Mapbender map. Is there a
>         way to get
>         >         the
>         >         >                 coordinates of a point when I
>         click on it on
>         >         the map?
>         >         >                 I want to use these coordinates in
>         my web
>         >         app.
>         >         >
>         >         >                 Thanks.
>         >         >
>         >         >
>         >         >
>         >         >
>         >         _______________________________________________
>         >         >                 Mapbender_users mailing list
>         >         >                 Mapbender_users at lists.osgeo.org
>         >         >
>         >
>         http://lists.osgeo.org/mailman/listinfo/mapbender_users
>         >         >
>         >         >
>         >         >
>         >         >
>         _______________________________________________
>         >         >         Mapbender_users mailing list
>         >         >         Mapbender_users at lists.osgeo.org
>         >         >
>         >
>         http://lists.osgeo.org/mailman/listinfo/mapbender_users
>         >         >
>         >         >
>         >         > _______________________________________________
>         >         > Mapbender_users mailing list
>         >         > Mapbender_users at lists.osgeo.org
>         >         >
>         http://lists.osgeo.org/mailman/listinfo/mapbender_users
>         >
>         >
>         >         --
>         >         ********************************************
>         >         Where2B Konferenz 2013
>         >         12. Dezember 2013 in Bonn
>         >         www.where2b-conference.com
>         >         ********************************************
>         >         --------------------------------------------
>         >         WhereGroup GmbH & Co. KG
>         >         Eifelstraße 7
>         >         53119 Bonn
>         >         Germany
>         >
>         >         Christian Wygoda
>         >         Anwendungsentwickler
>         >
>         >         Fon: +49 (0)228 / 90 90 38 - 15
>         >         Fax: +49 (0)228 / 90 90 38 - 11
>         >
>         >         info at wheregroup.com
>         >         www.wheregroup.com
>         >         Amtsgericht Bonn, HRA 6788
>         >         --------------------------------------------
>         >         Komplementärin:
>         >         WhereGroup Verwaltungs GmbH
>         >         vertreten durch:
>         >         Olaf Knopp, Peter Stamm
>         >         --------------------------------------------
>         >
>         >         _______________________________________________
>         >         Mapbender_users mailing list
>         >         Mapbender_users at lists.osgeo.org
>         >
>         http://lists.osgeo.org/mailman/listinfo/mapbender_users
>         >
>         >
>         > _______________________________________________
>         > Mapbender_users mailing list
>         > Mapbender_users at lists.osgeo.org
>         > http://lists.osgeo.org/mailman/listinfo/mapbender_users
>         
>         --
>         ********************************************
>         Where2B Konferenz 2013
>         12. Dezember 2013 in Bonn
>         www.where2b-conference.com
>         ********************************************
>         --------------------------------------------
>         WhereGroup GmbH & Co. KG
>         Eifelstraße 7
>         53119 Bonn
>         Germany
>         
>         Christian Wygoda
>         Anwendungsentwickler
>         
>         Fon: +49 (0)228 / 90 90 38 - 15
>         Fax: +49 (0)228 / 90 90 38 - 11
>         
>         info at wheregroup.com
>         www.wheregroup.com
>         Amtsgericht Bonn, HRA 6788
>         --------------------------------------------
>         Komplementärin:
>         WhereGroup Verwaltungs GmbH
>         vertreten durch:
>         Olaf Knopp, Peter Stamm
>         --------------------------------------------
>         
>         _______________________________________________
>         Mapbender_users mailing list
>         Mapbender_users at lists.osgeo.org
>         http://lists.osgeo.org/mailman/listinfo/mapbender_users
> 
> 
> _______________________________________________
> Mapbender_users mailing list
> Mapbender_users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/mapbender_users

-- 
********************************************
Where2B Konferenz 2013
12. Dezember 2013 in Bonn
www.where2b-conference.com
********************************************
--------------------------------------------
WhereGroup GmbH & Co. KG
Eifelstraße 7
53119 Bonn
Germany

Christian Wygoda
Anwendungsentwickler

Fon: +49 (0)228 / 90 90 38 - 15
Fax: +49 (0)228 / 90 90 38 - 11

info at wheregroup.com
www.wheregroup.com
Amtsgericht Bonn, HRA 6788
--------------------------------------------
Komplementärin:
WhereGroup Verwaltungs GmbH
vertreten durch:
Olaf Knopp, Peter Stamm
--------------------------------------------



More information about the Mapbender_users mailing list