Я нормалный программист но проблема моя в том, что я мало знаком с javascript, а учить его до такого уровня долго.
Или есть возможность работать с картами без помощи javascript? Может средствами Django(python)?
По мне так проще (да и быстрее) написать программу на python + Qt4, чем ковырять java.
Был бы очень признателен за помощь в этом вопросе!
Мой код слееный и скриптов собранных в гугле:
Код: Выделить всё
<!DOCTYPE HTML>
<html>
<head>
<title>Map</title>
<style type="text/css">
html, body, #basicMap {
width: 100%;
height: 100%;
margin: 0;
}
</style>
<script src="OpenLayers.js"></script>
<script>
var selectControl;
var selectedFeature;
function onPopupClose(evt)
{
selectControl.unselect(selectedFeature);
}
function onFeatureSelect(feature)
{
selectedFeature = feature;
popup = new OpenLayers.Popup.FramedCloud("chicken",
feature.geometry.getBounds().getCenterLonLat(),
null, feature.name, null, true, onPopupClose);
popup.panMapIfOutOfView = true;
popup.autoSize = true;
feature.popup = popup;
map.addPopup(popup);
}
function onFeatureUnselect(feature)
{
map.removePopup(feature.popup);
feature.popup.destroy();
feature.popup = null;
}
function init()
{
map = new OpenLayers.Map("basicMap");
var mapnik = new OpenLayers.Layer.OSM();
var fromProjection = new OpenLayers.Projection("EPSG:4326"); // Transform from WGS 1984
var toProjection = new OpenLayers.Projection("EPSG:900913"); // to Spherical Mercator Projection
var position = new OpenLayers.LonLat(55,55).transform( fromProjection, toProjection);
var zoom = 3;
map.addLayer(mapnik);
map.setCenter(position, zoom);
var vectorLayer = new OpenLayers.Layer.Vector("Vectors");
var point = new OpenLayers.Geometry.Point(55, 55).transform(new OpenLayers.Projection("EPSG:4326"), new OpenLayers.Projection("EPSG:900913"));
var feature = new OpenLayers.Feature.Vector(point, {some:'data'}, {externalGraphic: 'img/marker.png', graphicHeight: 21, graphicWidth: 16});
feature.name = "<b>Name: </b>Vasya<br><b>Familiya: </b>Pupkin</br>";
selectControl = new OpenLayers.Control.SelectFeature(vectorLayer,
{
onSelect: onFeatureSelect,
onUnselect: onFeatureUnselect
});
vectorLayer.addFeatures([feature]);
map.addLayer(vectorLayer);
map.addControl(selectControl);
selectControl.activate();
}
</script>
</head>
<body onload="init();">
<div id="basicMap"></div>
</body>
</html>