[OpenLayers-Dev] Openlayers, GeoJSON and PopUp attributes

Javier Carrasco jcarrasco at prodevelop.es
Mon Oct 31 05:03:39 EDT 2011


I did an uncomplete/demo code to show OpenLayers popups based on an html
template. I have not tested it on mobile.

The code is like that:

var p1 = new SmartPopup(map); // SmartPopup should be renamed to
TemplatePopupManager or similar
p1.addLayer('twitterPopup',layer1); // addLayer(templateId,
OpenLayers.Layer)

and inside the body

<div id="twitterPopup" style="visibility:hidden; display:none">
	<img src="%profile_image_url%" class="twimg"/>
	<a class="twuser"
href="http://twitter.com/%from_user%">%from_user%:</a>
	<a class="twtext"
href="http://twitter.com/%from_user%/status/%id_str%">%text%</a>
</div>

The words between %...% are attribute names of the feature.

You can see a demo here
http://gis.prodevelop.es/olsocial/ 

Do you think this is a good approach?

Regards 
Javi




-----Mensaje original-----
De: openlayers-dev-bounces at lists.osgeo.org
[mailto:openlayers-dev-bounces at lists.osgeo.org] En nombre de Noli Sicad
Enviado el: lunes, 31 de octubre de 2011 4:54
Para: OpenLayers-Dev Dev; openlayers-users
Asunto: [OpenLayers-Dev] Openlayers, GeoJSON and PopUp attributes

Hi,

Leaflet has nice way of incorporating generic PopUp and GeoJSON in
displaying feature attributes as illustrated below. It works in mobile
as well as in desktop browser.

http://leaflet.cloudmade.com/examples/geojson-example.html

Openlayers got one, but not on desktop and other framework aside from
Jquery mobile and Secha Touch.

Openlayers + GeoJSON has PopUp attributes for GeoJSON as seen in
mobile-jq example.

http://openlayers.org/dev/examples/mobile-jq.html#mappage

So as Sencha Touch.

http://openlayers.org/dev/examples/mobile-sencha.html

However, if you click on Sprinters icon in non mobile devices, the
popup would not work since it only caters to the specific windowing
framework (jQuery-mobile and Sencha Touch). In other words, it is
dependent to windowing toolkit.

Although, I am interested in mobile device framework i.e. jQTouch, it
does not have a popup control/ (window) to micmic JQM and Sencha
Touch.

Is there any way to do the GeoJSON attributes PopUp in generic OL PopUp?

GeoJSON is easier to handle than any other vector data as demonstrate
here below.

http://leaflet.cloudmade.com/examples/layers-control.html

Hope OpenLayers would have friendliers way of handling GeoJSON
especially in viewing the it attributes using a generic Popup window.

Or anybody has implemented this already? Any link?

(Post this URL below, before I get this as a reply :-)

http://dev.openlayers.org/releases/OpenLayers-2.11/examples/geojson.html
)

Thanks.

Noli
_______________________________________________
Dev mailing list
Dev at lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/openlayers-dev


More information about the Dev mailing list