David Whitchurch-Bennett
2010-Mar-23 13:48 UTC
[Mapstraction] OpenSpace and Multimap in Version 2
Hi there, I am wondering if this project is still active, and if so, do you know if OpenSpace and MultiMap will be implemented in version 2 anytime soon? Thanks, David -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.mapstraction.com/pipermail/mapstraction-mapstraction.com/attachments/20100323/1cdeda81/attachment.htm>
the project is active, and the software is in use on sites getting millions of users. You can use OSM via cloudmade or openlayers. Or feel free to contribute your own openstreetmap and/or multimap libraries - it''s not that much work to get basic functionality going. looking forward to your contributions Ed 2010/3/23 David Whitchurch-Bennett <david at nmaltd.com>:> Hi there, > > > > I am wondering if this project is still active, and if so, do you know if > OpenSpace and MultiMap will be implemented in version 2 anytime soon? > > > > Thanks, > > > > David > > > > _______________________________________________ > Mapstraction mailing list > Mapstraction at lists.mapstraction.com > http://lists.mapstraction.com/listinfo.cgi/mapstraction-mapstraction.com > >
David Whitchurch-Bennett wrote:> > Hi there, > > I am wondering if this project is still active, and if so, do you know > if OpenSpace and MultiMap will be implemented in version 2 anytime soon? >Indeed - very active. Which brings up a good point. After the recent SXSW, as well as next week''s Where2.0 and WhereCamp there is an increased interest in the project. At the same time, as David points out it''s not clear where things are happening and being updated. This has been my fault in not updating things as fast as this great team is making things happen. I''m could use help maintaining mapstraction.com and the API sandbox. The website is mostly in the old SVN - so could be updated and deployed by any number of other volunteers, just need some mechanism to have it push to the/a server. The API Sandbox is on Google AppEngine, so could have others update. Let me know if you can help out with updating some of these pieces. We have a great opportunity as we get into Conference season of showing off the great work on V2 and getting a lot more developers and users onboard. Thanks! Andrew> Thanks, > > David > > ------------------------------------------------------------------------ > > _______________________________________________ > Mapstraction mailing list > Mapstraction at lists.mapstraction.com > http://lists.mapstraction.com/listinfo.cgi/mapstraction-mapstraction.com >-- Andrew Turner m: 248.982.3609 e: andrew at highearthorbit.com t: @ajturner b: http://highearthorbit.com w: http://geocommons.com Introduction to Neogeography - http://oreilly.com/catalog/neogeography -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.mapstraction.com/pipermail/mapstraction-mapstraction.com/attachments/20100323/4bb12d66/attachment.htm>
On Tue, Mar 23, 2010 at 6:53 AM, Ed Freyfogle <edf at sloan.mit.edu> wrote:> > You can use OSM via cloudmade or openlayers. > >I''ve noticed that the plain OSM map type in both the openlayers v1 demo ( http://mapstraction.com/demo.php?map=openlayers) and the API Sandbox ( http://mapstraction.appspot.com/#openlayers) doesn''t seem to load, and I''m having the same issue in my implementation. If I include the script at http://www.openstreetmap.org/openlayers/OpenStreetMap.js I get the "not found" tiles, but I haven''t figured out yet why the OSM tiles aren''t loading. If you try it and make progress, please share! -dylan- -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.mapstraction.com/pipermail/mapstraction-mapstraction.com/attachments/20100323/6d82e177/attachment.htm>
Hi David, best way to get started on v2 is to copy source/mxn.(provider).core.js to a file names mxn.openspace.core.js and then start making the functions you need work good luck Ed 2010/3/23 David Whitchurch-Bennett <david at nmaltd.com>:> Hi Ed, Andrew and Dylan, > > Thanks for the quick responses! > > I was interested particularly in OpenSpace which is Ordinance Survey Mapping > in the UK. I couldn''t find any source files, so I don''t know if this has > been started yet. If there are any source files that can be looked at, I''d > like to try to help, particularly as this works in version 1. > > Thanks, > > David > > -----Original Message----- > From: freyfogle at gmail.com [mailto:freyfogle at gmail.com] On Behalf Of Ed > Freyfogle > Sent: 23 March 2010 13:53 > To: David Whitchurch-Bennett > Cc: mapstraction at lists.mapstraction.com > Subject: Re: [Mapstraction] OpenSpace and Multimap in Version 2 > > the project is active, and the software is in use on sites getting > millions of users. > > You can use OSM via cloudmade or openlayers. > > Or feel free to contribute your own openstreetmap and/or multimap > libraries - it''s not that much work to get basic functionality going. > > looking forward to your contributions > Ed > > > > 2010/3/23 David Whitchurch-Bennett <david at nmaltd.com>: >> Hi there, >> >> >> >> I am wondering if this project is still active, and if so, do you know if >> OpenSpace and MultiMap will be implemented in version 2 anytime soon? >> >> >> >> Thanks, >> >> >> >> David >> >> >> >> _______________________________________________ >> Mapstraction mailing list >> Mapstraction at lists.mapstraction.com >> http://lists.mapstraction.com/listinfo.cgi/mapstraction-mapstraction.com >> >> > >
David Whitchurch-Bennett
2010-Mar-23 18:49 UTC
[Mapstraction] OpenSpace and Multimap in Version 2
Hi everyone,
I''ve written some code for the mxn.openspace.core.js file, but I
can''t
upload it with SVN as I don''t have write acces. Please find the code
below
which works for me so far. I haven''t fully checked everything, but
it''s a
starting point. For now, it loads the map and displays markers. The markers
currently aren''t working with clicks, but I''ll get this
figured out I''m
sure.
The code has come from version 1 of this API, with a few modifications to
suit the new standards.
mxn.register(''openspace'', {
Mapstraction: {
init: function(element, api) {
var me = this;
// create the map with no controls and don''t centre popup
info window
this.maps[api] = new OpenSpace.Map(element,{
controls: [],
centreInfoWindow: false
});
// note that these three controls are always there and the fact that
there
// are three resident controls is used in addControls()
// enable map drag with mouse and keyboard
this.maps[api].addControl(new OpenLayers.Control.Navigation());
this.maps[api].addControl(new
OpenLayers.Control.KeyboardDefaults());
// include copyright statement
this.maps[api].addControl(new
OpenSpace.Control.CopyrightCollection());
this.maps[api].events.register("click", this.maps[api],
function(evt) {
var point = this.getLonLatFromViewPortPx( evt.xy );
// convert to LatLonPoint
var llPoint = new mxn.LatLonPoint;
llPoint.fromProprietary(this.api, point);
me.clickHandler( llPoint.lat, llPoint.lon );
return false;
});
this.loaded[api] = true;
},
applyOptions: function(){
var map = this.maps[this.api];
// TODO: Add provider code
},
resizeTo: function(width, height){
this.currentElement.style.width = width;
this.currentElement.style.height = height;
this.maps[this.api].updateSize();
},
addControls: function( args ) {
var map = this.maps[this.api];
// remove existing controls but leave the basic navigation,
keyboard and copyright controls in place
// these were added in addAPI and not normally be removed
for (var i = map.controls.length; i>3; i--) {
map.controls[i-1].deactivate();
map.removeControl(map.controls[i-1]);
}
// pan and zoom controls not available separately
if ( args.zoom == ''large'') {
map.addControl(new OpenSpace.Control.LargeMapControl());
}
else if ( args.zoom == ''small'' || args.pan ) {
map.addControl(new OpenSpace.Control.SmallMapControl());
}
if ( args.overview ) {
// this should work but as of OpenSpace 0.7.2 generates an error
unless done before setCenterAndZoom
var osOverviewControl = new OpenSpace.Control.OverviewMap();
map.addControl(osOverviewControl);
osOverviewControl.maximizeControl();
}
if ( args.map_type ) {
// this is all you get with openspace, a control to switch on or
off the layers and markers
// probably not much use to anybody
map.addControl(new OpenLayers.Control.LayerSwitcher());
}
},
addSmallControls: function() {
var map = this.maps[this.api];
map.addControl(new OpenSpace.Control.SmallMapControl());
},
addLargeControls: function() {
var map = this.maps[this.api];
map.addControl(new OpenSpace.Control.LargeMapControl());
},
addMapTypeControls: function() {
var map = this.maps[this.api];
// TODO: Add provider code
},
setCenterAndZoom: function(point, zoom) {
var map = this.maps[this.api];
var pt = point.toProprietary(this.api);
var oszoom = zoom-6;
if (oszoom<0) {
oszoom = 0;
}
else if (oszoom>10) {
oszoom = 10;
}
map.setCenter(pt, oszoom);
},
addMarker: function(marker, old) {
var map = this.maps[this.api];
var pin = marker.toProprietary(this.api);
map.addOverlay(pin);
return pin;
},
removeMarker: function(marker) {
var map = this.maps[this.api];
// TODO: Add provider code
},
removeAllMarkers: function() {
var map = this.maps[this.api];
// TODO: Add provider code
},
declutterMarkers: function(opts) {
var map = this.maps[this.api];
// TODO: Add provider code
},
addPolyline: function(polyline, old) {
var map = this.maps[this.api];
var pl = polyline.toProprietary(this.api);
// TODO: Add provider code
return pl;
},
removePolyline: function(polyline) {
var map = this.maps[this.api];
// TODO: Add provider code
},
getCenter: function() {
var point;
var map = this.maps[this.api];
var pt = map.getCenter(); // an OpenSpace.MapPoint, UK
National Grid
point = new mxn.LatLonPoint();
point.fromOpenSpace(pt); // convert to LatLonPoint
return point;
},
setCenter: function(point, options) {
var map = this.maps[this.api];
var pt = point.toProprietary(this.api);
if(options && options.pan) {
map.setCenter(pt.toProprietary(this.api));
}
else {
map.setCenter(pt.toProprietary(this.api));
}
},
setZoom: function(zoom) {
var map = this.maps[this.api];
var oszoom = zoom-6;
if (oszoom<0) {
oszoom = 0;
}
else if (oszoom>10) {
oszoom = 10;
}
map.zoomTo(oszoom);
},
getZoom: function() {
var map = this.maps[this.api];
var zoom;
zoom = map.zoom + 6; // convert to equivalent google zoom
return zoom;
},
getZoomLevelForBoundingBox: function( bbox ) {
var map = this.maps[this.api];
// NE and SW points from the bounding box.
var ne = bbox.getNorthEast();
var sw = bbox.getSouthWest();
var zoom;
var obounds = new OpenSpace.MapBounds();
obounds.extend(new
mxn.LatLonPoint(sw.lat,sw.lon).toProprietary(this.api));
obounds.extend(new
mxn.LatLonPoint(ne.lat,ne.lon).toProprietary(this.api));
zoom = map.getZoomForExtent(obounds) + 6; // get it and adjust to
equivalent google zoom
return zoom;
},
setMapType: function(type) {
var map = this.maps[this.api];
switch(type) {
case mxn.Mapstraction.ROAD:
// TODO: Add provider code
break;
case mxn.Mapstraction.SATELLITE:
// TODO: Add provider code
break;
case mxn.Mapstraction.HYBRID:
// TODO: Add provider code
break;
default:
// TODO: Add provider code
}
},
getMapType: function() {
var map = this.maps[this.api];
// TODO: Add provider code
//return mxn.Mapstraction.ROAD;
//return mxn.Mapstraction.SATELLITE;
//return mxn.Mapstraction.HYBRID;
},
getBounds: function () {
var map = this.maps[this.api];
var olbox = map.calculateBounds().toArray(); // array of
openspace coords, left, bottom, right, top
var ossw = new OpenSpace.MapPoint( olbox[0], olbox[1] );
var osne = new OpenSpace.MapPoint( olbox[2], olbox[3] );
// convert to LatLonPoints
var sw = new mxn.LatLonPoint;
sw.fromOpenSpace(ossw);
var ne = new mxn.LatLonPoint;
ne.fromOpenSpace(osne);
return new mxn.BoundingBox(sw.lat, sw.lon, ne.lat, ne.lon);
//return new mxn.BoundingBox( , , , );
},
setBounds: function(bounds){
var map = this.maps[this.api];
var sw = bounds.getSouthWest();
var ne = bounds.getNorthEast();
var obounds = new OpenSpace.MapBounds();
obounds.extend(new
mxn.LatLonPoint(sw.lat,sw.lon).toProprietary(this.api));
obounds.extend(new
mxn.LatLonPoint(ne.lat,ne.lon).toProprietary(this.api));
map.zoomToExtent(obounds);
},
addImageOverlay: function(id, src, opacity, west, south, east,
north, oContext) {
var map = this.maps[this.api];
// TODO: Add provider code
},
setImagePosition: function(id, oContext) {
var map = this.maps[this.api];
var topLeftPoint; var bottomRightPoint;
// TODO: Add provider code
//oContext.pixels.top = ...;
//oContext.pixels.left = ...;
//oContext.pixels.bottom = ...;
//oContext.pixels.right = ...;
},
addOverlay: function(url, autoCenterAndZoom) {
var map = this.maps[this.api];
// TODO: Add provider code
},
addTileLayer: function(tile_url, opacity, copyright_text, min_zoom,
max_zoom) {
var map = this.maps[this.api];
// TODO: Add provider code
},
toggleTileLayer: function(tile_url) {
var map = this.maps[this.api];
// TODO: Add provider code
},
getPixelRatio: function() {
var map = this.maps[this.api];
// TODO: Add provider code
},
mousePosition: function(element) {
var map = this.maps[this.api];
try {
map.events.register(''mousemove'', map, function (e)
{
var lonLat = map.getLonLatFromViewPortPx(e.xy);
var lon = lonLat.lon * (180.0 / 20037508.34);
var lat = lonLat.lat * (180.0 / 20037508.34);
lat
(180/Math.PI)*(2*Math.atan(Math.exp(lat*Math.PI/180))-(Math.PI/2));
var loc = numFormatFloat(lat,4) + '' / '' +
numFormatFloat(lon,4);
// numFormatFloat(X,4) simply formats floating point
''X'' to
4 dec places
locDisp.innerHTML = loc;
});
locDisp.innerHTML = ''0.0000 / 0.0000'';
} catch (x) {
alert("Error: " + x);
}
// TODO: Add provider code
}
},
LatLonPoint: {
toProprietary: function() {
var lonlat = new OpenLayers.LonLat(this.lon, this.lat);
// need to convert to UK national grid
var gridProjection = new OpenSpace.GridProjection();
return gridProjection.getMapPointFromLonLat(lonlat); // on
OpenSpace.MapPoint
},
fromProprietary: function(osPoint) {
var gridProjection = new OpenSpace.GridProjection();
var olpt = gridProjection.getLonLatFromMapPoint(osPoint); // an
OpenLayers.LonLat
this.lon = olpt.lon;
this.lat = olpt.lat;
}
},
Marker: {
toProprietary: function() {
var size, anchor, icon;
if(this.iconSize) {
size = new OpenLayers.Size(this.iconSize[0],
this.iconSize[1]);
}
else {
size = new OpenLayers.Size(20,25);
}
if(this.iconAnchor) {
anchor = new OpenLayers.Pixel(this.iconAnchor[0],
this.iconAnchor[1]);
}
else {
// FIXME: hard-coding the anchor point
anchor = new OpenLayers.Pixel(-(size.w/2), -size.h);
}
if(this.iconUrl) {
icon = new OpenSpace.Icon(this.iconUrl, size, anchor);
}
else { // leave at default OpenSpace icon
}
// This requires an OpenLayers specific hack, doesn''t work when
not including OpenLayers.js
// if (this.labelText) {
// var marker = new
OpenLayers.Marker.Label(this.location.toProprietary(this.api), icon,
this.labelText, {mouseOver:true,tooltipsFormat:true});
// }
// else {
var marker = new
OpenLayers.Marker(this.location.toProprietary(this.api), icon);
// }
return marker;
},
openBubble: function() {
// TODO: Add provider code
},
hide: function() {
// TODO: Add provider code
},
show: function() {
// TODO: Add provider code
},
update: function() {
// TODO: Add provider code
}
},
Polyline: {
toProprietary: function() {
var ospolyline;
var ospoints = [];
for (var i = 0, length = this.points.length ; i< length; i++){
// convert each point to OpenSpace.MapPoint
var ospoint = this.points[i].toProprietary(this.api);
var olgpoint = new OpenLayers.Geometry.Point(ospoint.getEasting(),
ospoint.getNorthing());
ospoints.push(olgpoint);
}
if (this.closed) {
ospolyline = new OpenLayers.Feature.Vector(new
OpenLayers.Geometry.LinearRing(ospoints), null, {
fillColor: this.color,
strokeColor: this.color,
strokeOpacity: this.opacity,
fillOpacity: this.opacity,
strokeWidth: this.width
});
}
else {
ospolyline = new OpenLayers.Feature.Vector(new
OpenLayers.Geometry.LineString(ospoints), null, {
fillColor: 0,
strokeColor: this.color,
strokeOpacity: this.opacity,
fillOpacity: 0,
strokeWidth: this.width
});
}
return ospolyline;
},
show: function() {
// TODO: Add provider code
},
hide: function() {
// TODO: Add provider code
}
}
});
-----Original Message-----
From: freyfogle at gmail.com [mailto:freyfogle at gmail.com] On Behalf Of Ed
Freyfogle
Sent: 23 March 2010 14:35
To: David Whitchurch-Bennett; mapstraction at lists.mapstraction.com
Subject: Re: [Mapstraction] OpenSpace and Multimap in Version 2
Hi David,
best way to get started on v2 is to copy source/mxn.(provider).core.js
to a file names mxn.openspace.core.js and then start making the
functions you need work
good luck
Ed
2010/3/23 David Whitchurch-Bennett <david at
nmaltd.com>:> Hi Ed, Andrew and Dylan,
>
> Thanks for the quick responses!
>
> I was interested particularly in OpenSpace which is Ordinance Survey
Mapping> in the UK. I couldn''t find any source files, so I don''t
know if this has
> been started yet. If there are any source files that can be looked at,
I''d
> like to try to help, particularly as this works in version 1.
>
> Thanks,
>
> David
>
> -----Original Message-----
> From: freyfogle at gmail.com [mailto:freyfogle at gmail.com] On Behalf Of
Ed
> Freyfogle
> Sent: 23 March 2010 13:53
> To: David Whitchurch-Bennett
> Cc: mapstraction at lists.mapstraction.com
> Subject: Re: [Mapstraction] OpenSpace and Multimap in Version 2
>
> the project is active, and the software is in use on sites getting
> millions of users.
>
> You can use OSM via cloudmade or openlayers.
>
> Or feel free to contribute your own openstreetmap and/or multimap
> libraries - it''s not that much work to get basic functionality
going.
>
> looking forward to your contributions
> Ed
>
>
>
> 2010/3/23 David Whitchurch-Bennett <david at nmaltd.com>:
>> Hi there,
>>
>>
>>
>> I am wondering if this project is still active, and if so, do you know
if
>> OpenSpace and MultiMap will be implemented in version 2 anytime soon?
>>
>>
>>
>> Thanks,
>>
>>
>>
>> David
>>
>>
>>
>> _______________________________________________
>> Mapstraction mailing list
>> Mapstraction at lists.mapstraction.com
>>
http://lists.mapstraction.com/listinfo.cgi/mapstraction-mapstraction.com
>>
>>
>
>
Hi David, I cut and pasted this into a file and checked it in. http://code.google.com/p/mapstraction/source/detail?r=76 thanks for contributing Ed 2010/3/23 David Whitchurch-Bennett <david at nmaltd.com>:> Hi everyone, > > I''ve written some code for the mxn.openspace.core.js file, but I can''t > upload it with SVN as I don''t have write acces. Please find the code below > which works for me so far. I haven''t fully checked everything, but it''s a > starting point. For now, it loads the map and displays markers. The markers > currently aren''t working with clicks, but I''ll get this figured out I''m > sure. > > The code has come from version 1 of this API, with a few modifications to > suit the new standards. > > mxn.register(''openspace'', { > > Mapstraction: { > > ? ? ? ?init: function(element, api) { > ? ? ? ? ? ? ? ?var me = this; > ? ? ? ? ? ? ? ?// create the map with no controls and don''t centre popup > info window > ? ? ? ?this.maps[api] = new OpenSpace.Map(element,{ > ? ? ? ? ? ?controls: [], > ? ? ? ? ? ?centreInfoWindow: false > ? ? ? ?}); > ? ? ? ?// note that these three controls are always there and the fact that > there > ? ? ? ?// are three resident controls is used in addControls() > ? ? ? ?// enable map drag with mouse and keyboard > ? ? ? ?this.maps[api].addControl(new OpenLayers.Control.Navigation()); > ? ? ? ?this.maps[api].addControl(new > OpenLayers.Control.KeyboardDefaults()); > ? ? ? ?// include copyright statement > ? ? ? ?this.maps[api].addControl(new > OpenSpace.Control.CopyrightCollection()); > > ? ? ? ?this.maps[api].events.register("click", this.maps[api], > function(evt) { > ? ? ? ? ? ?var point = this.getLonLatFromViewPortPx( evt.xy ); > ? ? ? ? ? ?// convert to LatLonPoint > ? ? ? ? ? ?var llPoint = new mxn.LatLonPoint; > ? ? ? ? ? ?llPoint.fromProprietary(this.api, point); > ? ? ? ? ? ?me.clickHandler( llPoint.lat, llPoint.lon ); > ? ? ? ? ? ?return false; > ? ? ? ?}); > ? ? ? ?this.loaded[api] = true; > ? ? ? ?}, > > ? ? ? ?applyOptions: function(){ > ? ? ? ? ? ? ? ?var map = this.maps[this.api]; > > ? ? ? ? ? ? ? ?// TODO: Add provider code > ? ? ? ?}, > > ? ? ? ?resizeTo: function(width, height){ > ? ? ? ? ? ? ? ?this.currentElement.style.width = width; > ? ? ? ?this.currentElement.style.height = height; > ? ? ? ?this.maps[this.api].updateSize(); > ? ? ? ?}, > > ? ? ? ?addControls: function( args ) { > ? ? ? ? ? ? ? ?var map = this.maps[this.api]; > ? ? ? ? ? ? ? ?// remove existing controls but leave the basic navigation, > keyboard and copyright controls in place > ? ? ? ?// these were added in addAPI and not normally be removed > ? ? ? ?for (var i = map.controls.length; i>3; i--) { > ? ? ? ? ? ?map.controls[i-1].deactivate(); > ? ? ? ? ? ?map.removeControl(map.controls[i-1]); > ? ? ? ?} > ? ? ? ?// pan and zoom controls not available separately > ? ? ? ?if ( args.zoom == ''large'') { > ? ? ? ? ? ?map.addControl(new OpenSpace.Control.LargeMapControl()); > ? ? ? ?} > ? ? ? ?else if ( args.zoom == ''small'' || args.pan ) { > ? ? ? ? ? ?map.addControl(new OpenSpace.Control.SmallMapControl()); > ? ? ? ?} > ? ? ? ?if ( args.overview ) { > ? ? ? ? ? ?// this should work but as of OpenSpace 0.7.2 generates an error > unless done before setCenterAndZoom > ? ? ? ? ? ?var osOverviewControl = new OpenSpace.Control.OverviewMap(); > ? ? ? ? ? ?map.addControl(osOverviewControl); > ? ? ? ? ? ?osOverviewControl.maximizeControl(); > ? ? ? ?} > ? ? ? ?if ( args.map_type ) { > ? ? ? ? ? ?// this is all you get with openspace, a control to switch on or > off the layers and markers > ? ? ? ? ? ?// probably not much use to anybody > ? ? ? ? ? ?map.addControl(new OpenLayers.Control.LayerSwitcher()); > ? ? ? ?} > ? ? ? ?}, > > ? ? ? ?addSmallControls: function() { > ? ? ? ? ? ? ? ?var map = this.maps[this.api]; > ? ? ? ? ? ? ? ?map.addControl(new OpenSpace.Control.SmallMapControl()); > ? ? ? ?}, > > ? ? ? ?addLargeControls: function() { > ? ? ? ? ? ? ? ?var map = this.maps[this.api]; > ? ? ? ? ? ? ? ?map.addControl(new OpenSpace.Control.LargeMapControl()); > ? ? ? ?}, > > ? ? ? ?addMapTypeControls: function() { > ? ? ? ? ? ? ? ?var map = this.maps[this.api]; > > ? ? ? ? ? ? ? ?// TODO: Add provider code > ? ? ? ?}, > > ? ? ? ?setCenterAndZoom: function(point, zoom) { > ? ? ? ? ? ? ? ?var map = this.maps[this.api]; > ? ? ? ? ? ? ? ?var pt = point.toProprietary(this.api); > > ? ? ? ? ? ? ? ?var oszoom = zoom-6; > ? ? ? ?if (oszoom<0) { > ? ? ? ? ? ?oszoom = 0; > ? ? ? ?} > ? ? ? ?else if (oszoom>10) { > ? ? ? ? ? ?oszoom = 10; > ? ? ? ?} > ? ? ? ?map.setCenter(pt, oszoom); > ? ? ? ?}, > > ? ? ? ?addMarker: function(marker, old) { > ? ? ? ? ? ? ? ?var map = this.maps[this.api]; > ? ? ? ? ? ? ? ?var pin = marker.toProprietary(this.api); > > ? ? ? ? ? ? ? ?map.addOverlay(pin); > > ? ? ? ? ? ? ? ?return pin; > ? ? ? ?}, > > ? ? ? ?removeMarker: function(marker) { > ? ? ? ? ? ? ? ?var map = this.maps[this.api]; > > ? ? ? ? ? ? ? ?// TODO: Add provider code > ? ? ? ?}, > > ? ? ? ?removeAllMarkers: function() { > ? ? ? ? ? ? ? ?var map = this.maps[this.api]; > > ? ? ? ? ? ? ? ?// TODO: Add provider code > ? ? ? ?}, > > ? ? ? ?declutterMarkers: function(opts) { > ? ? ? ? ? ? ? ?var map = this.maps[this.api]; > > ? ? ? ? ? ? ? ?// TODO: Add provider code > ? ? ? ?}, > > ? ? ? ?addPolyline: function(polyline, old) { > ? ? ? ? ? ? ? ?var map = this.maps[this.api]; > ? ? ? ? ? ? ? ?var pl = polyline.toProprietary(this.api); > > ? ? ? ? ? ? ? ?// TODO: Add provider code > > ? ? ? ? ? ? ? ?return pl; > ? ? ? ?}, > > ? ? ? ?removePolyline: function(polyline) { > ? ? ? ? ? ? ? ?var map = this.maps[this.api]; > > ? ? ? ? ? ? ? ?// TODO: Add provider code > ? ? ? ?}, > > ? ? ? ?getCenter: function() { > ? ? ? ? ? ? ? ?var point; > ? ? ? ? ? ? ? ?var map = this.maps[this.api]; > > ? ? ? ? ? ? ? ?var pt = map.getCenter(); // an OpenSpace.MapPoint, UK > National Grid > ? ? ? ?point = new mxn.LatLonPoint(); > ? ? ? ?point.fromOpenSpace(pt); ?// convert to LatLonPoint > > ? ? ? ? ? ? ? ?return point; > ? ? ? ?}, > > ? ? ? ?setCenter: function(point, options) { > ? ? ? ? ? ? ? ?var map = this.maps[this.api]; > ? ? ? ? ? ? ? ?var pt = point.toProprietary(this.api); > ? ? ? ? ? ? ? ?if(options && options.pan) { > ? ? ? ? ? ? ? ? ? ? ? ?map.setCenter(pt.toProprietary(this.api)); > ? ? ? ? ? ? ? ?} > ? ? ? ? ? ? ? ?else { > ? ? ? ? ? ? ? ? ? ? ? ?map.setCenter(pt.toProprietary(this.api)); > ? ? ? ? ? ? ? ?} > ? ? ? ?}, > > ? ? ? ?setZoom: function(zoom) { > ? ? ? ? ? ? ? ?var map = this.maps[this.api]; > > ? ? ? ? ? ? ? ?var oszoom = zoom-6; > ? ? ? ?if (oszoom<0) { > ? ? ? ? ? ?oszoom = 0; > ? ? ? ?} > ? ? ? ?else if (oszoom>10) { > ? ? ? ? ? ?oszoom = 10; > ? ? ? ?} > ? ? ? ?map.zoomTo(oszoom); > > ? ? ? ?}, > > ? ? ? ?getZoom: function() { > ? ? ? ? ? ? ? ?var map = this.maps[this.api]; > ? ? ? ? ? ? ? ?var zoom; > > ? ? ? ? ? ? ? ?zoom = map.zoom + 6; ?// convert to equivalent google zoom > > ? ? ? ? ? ? ? ?return zoom; > ? ? ? ?}, > > ? ? ? ?getZoomLevelForBoundingBox: function( bbox ) { > ? ? ? ? ? ? ? ?var map = this.maps[this.api]; > ? ? ? ? ? ? ? ?// NE and SW points from the bounding box. > ? ? ? ? ? ? ? ?var ne = bbox.getNorthEast(); > ? ? ? ? ? ? ? ?var sw = bbox.getSouthWest(); > ? ? ? ? ? ? ? ?var zoom; > > ? ? ? ? ? ? ? ?var obounds = new OpenSpace.MapBounds(); > ? ? ? ?obounds.extend(new > mxn.LatLonPoint(sw.lat,sw.lon).toProprietary(this.api)); > ? ? ? ?obounds.extend(new > mxn.LatLonPoint(ne.lat,ne.lon).toProprietary(this.api)); > ? ? ? ?zoom = map.getZoomForExtent(obounds) + 6; // get it and adjust to > equivalent google zoom > > ? ? ? ? ? ? ? ?return zoom; > ? ? ? ?}, > > ? ? ? ?setMapType: function(type) { > ? ? ? ? ? ? ? ?var map = this.maps[this.api]; > ? ? ? ? ? ? ? ?switch(type) { > ? ? ? ? ? ? ? ? ? ? ? ?case mxn.Mapstraction.ROAD: > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?// TODO: Add provider code > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?break; > ? ? ? ? ? ? ? ? ? ? ? ?case mxn.Mapstraction.SATELLITE: > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?// TODO: Add provider code > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?break; > ? ? ? ? ? ? ? ? ? ? ? ?case mxn.Mapstraction.HYBRID: > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?// TODO: Add provider code > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?break; > ? ? ? ? ? ? ? ? ? ? ? ?default: > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?// TODO: Add provider code > ? ? ? ? ? ? ? ?} > ? ? ? ?}, > > ? ? ? ?getMapType: function() { > ? ? ? ? ? ? ? ?var map = this.maps[this.api]; > > ? ? ? ? ? ? ? ?// TODO: Add provider code > > ? ? ? ? ? ? ? ?//return mxn.Mapstraction.ROAD; > ? ? ? ? ? ? ? ?//return mxn.Mapstraction.SATELLITE; > ? ? ? ? ? ? ? ?//return mxn.Mapstraction.HYBRID; > > ? ? ? ?}, > > ? ? ? ?getBounds: function () { > ? ? ? ? ? ? ? ?var map = this.maps[this.api]; > > ? ? ? ? ? ? ? ?var olbox = map.calculateBounds().toArray(); // array of > openspace coords, left, bottom, right, top > ? ? ? ?var ossw = new OpenSpace.MapPoint( olbox[0], olbox[1] ); > ? ? ? ?var osne = new OpenSpace.MapPoint( olbox[2], olbox[3] ); > ? ? ? ?// convert to LatLonPoints > ? ? ? ?var sw = new mxn.LatLonPoint; > ? ? ? ?sw.fromOpenSpace(ossw); > ? ? ? ?var ne = new mxn.LatLonPoint; > ? ? ? ?ne.fromOpenSpace(osne); > ? ? ? ?return new mxn.BoundingBox(sw.lat, sw.lon, ne.lat, ne.lon); > > ? ? ? ? ? ? ? ?//return new mxn.BoundingBox( , ?, ?, ?); > ? ? ? ?}, > > ? ? ? ?setBounds: function(bounds){ > ? ? ? ? ? ? ? ?var map = this.maps[this.api]; > ? ? ? ? ? ? ? ?var sw = bounds.getSouthWest(); > ? ? ? ? ? ? ? ?var ne = bounds.getNorthEast(); > > ? ? ? ? ? ? ? ?var obounds = new OpenSpace.MapBounds(); > ? ? ? ?obounds.extend(new > mxn.LatLonPoint(sw.lat,sw.lon).toProprietary(this.api)); > ? ? ? ?obounds.extend(new > mxn.LatLonPoint(ne.lat,ne.lon).toProprietary(this.api)); > ? ? ? ?map.zoomToExtent(obounds); > > ? ? ? ?}, > > ? ? ? ?addImageOverlay: function(id, src, opacity, west, south, east, > north, oContext) { > ? ? ? ? ? ? ? ?var map = this.maps[this.api]; > > ? ? ? ? ? ? ? ?// TODO: Add provider code > ? ? ? ?}, > > ? ? ? ?setImagePosition: function(id, oContext) { > ? ? ? ? ? ? ? ?var map = this.maps[this.api]; > ? ? ? ? ? ? ? ?var topLeftPoint; var bottomRightPoint; > > ? ? ? ? ? ? ? ?// TODO: Add provider code > > ? ? ? ? ? ? ? ?//oContext.pixels.top = ...; > ? ? ? ? ? ? ? ?//oContext.pixels.left = ...; > ? ? ? ? ? ? ? ?//oContext.pixels.bottom = ...; > ? ? ? ? ? ? ? ?//oContext.pixels.right = ...; > ? ? ? ?}, > > ? ? ? ?addOverlay: function(url, autoCenterAndZoom) { > ? ? ? ? ? ? ? ?var map = this.maps[this.api]; > > ? ? ? ? ? ? ? ?// TODO: Add provider code > > ? ? ? ?}, > > ? ? ? ?addTileLayer: function(tile_url, opacity, copyright_text, min_zoom, > max_zoom) { > ? ? ? ? ? ? ? ?var map = this.maps[this.api]; > > ? ? ? ? ? ? ? ?// TODO: Add provider code > ? ? ? ?}, > > ? ? ? ?toggleTileLayer: function(tile_url) { > ? ? ? ? ? ? ? ?var map = this.maps[this.api]; > > ? ? ? ? ? ? ? ?// TODO: Add provider code > ? ? ? ?}, > > ? ? ? ?getPixelRatio: function() { > ? ? ? ? ? ? ? ?var map = this.maps[this.api]; > > ? ? ? ? ? ? ? ?// TODO: Add provider code > ? ? ? ?}, > > ? ? ? ?mousePosition: function(element) { > ? ? ? ? ? ? ? ?var map = this.maps[this.api]; > > ? ? ? ?try { > ? ? ? ? ? ?map.events.register(''mousemove'', map, function (e) { > ? ? ? ? ? ? ? ?var lonLat = map.getLonLatFromViewPortPx(e.xy); > ? ? ? ? ? ? ? ?var lon = lonLat.lon * (180.0 / 20037508.34); > ? ? ? ? ? ? ? ?var lat = lonLat.lat * (180.0 / 20037508.34); > ? ? ? ? ? ? ? ?lat > (180/Math.PI)*(2*Math.atan(Math.exp(lat*Math.PI/180))-(Math.PI/2)); > ? ? ? ? ? ? ? ?var loc = numFormatFloat(lat,4) + '' / '' + > numFormatFloat(lon,4); > ? ? ? ? ? ? ? ?// numFormatFloat(X,4) simply formats floating point ''X'' to > 4 dec places > ? ? ? ? ? ? ? ?locDisp.innerHTML = loc; > ? ? ? ? ? ?}); > ? ? ? ? ? ?locDisp.innerHTML = ''0.0000 / 0.0000''; > ? ? ? ?} catch (x) { > ? ? ? ? ?alert("Error: " + x); > ? ? ? ?} > > ? ? ? ? ? ? ? ?// TODO: Add provider code > ? ? ? ?} > }, > > LatLonPoint: { > > ? ? ? ?toProprietary: function() { > ? ? ? ? ? ? ? ?var lonlat = new OpenLayers.LonLat(this.lon, this.lat); > ? ? ? ? ? ?// need to convert to UK national grid > ? ? ? ? ? ?var gridProjection = new OpenSpace.GridProjection(); > ? ? ? ? ? ?return gridProjection.getMapPointFromLonLat(lonlat); // on > OpenSpace.MapPoint > ? ? ? ?}, > > ? ? ? ?fromProprietary: function(osPoint) { > ? ? ? ? ? ? ? ?var gridProjection = new OpenSpace.GridProjection(); > ? ? ? ? ? ?var olpt = gridProjection.getLonLatFromMapPoint(osPoint); // an > OpenLayers.LonLat > ? ? ? ? ? ?this.lon = olpt.lon; > ? ? ? ? ? ?this.lat = olpt.lat; > ? ? ? ?} > > }, > > Marker: { > > ? ? ? ?toProprietary: function() { > ? ? ? ? ? ? ? ?var size, anchor, icon; > ? ? ? ? ? ?if(this.iconSize) { > ? ? ? ? ? ? ? ?size = new OpenLayers.Size(this.iconSize[0], > this.iconSize[1]); > ? ? ? ? ? ?} > ? ? ? ? ? ?else { > ? ? ? ? ? ? ? ?size = new OpenLayers.Size(20,25); > ? ? ? ? ? ?} > > ? ? ? ? ? ?if(this.iconAnchor) { > ? ? ? ? ? ? ? ?anchor = new OpenLayers.Pixel(this.iconAnchor[0], > this.iconAnchor[1]); > ? ? ? ? ? ?} > ? ? ? ? ? ?else { > ? ? ? ? ? ? ? ?// FIXME: hard-coding the anchor point > ? ? ? ? ? ? ? ?anchor = new OpenLayers.Pixel(-(size.w/2), -size.h); > ? ? ? ? ? ?} > > ? ? ? ? ? ?if(this.iconUrl) { > ? ? ? ? ? ? ? ?icon = new OpenSpace.Icon(this.iconUrl, size, anchor); > ? ? ? ? ? ?} > ? ? ? ? ? ?else { // leave at default OpenSpace icon > ? ? ? ? ? ?} > > ? ? ? ? ? ?// ?This requires an OpenLayers specific hack, doesn''t work when > not including OpenLayers.js > ? ? ? ? ? ?// if (this.labelText) { > ? ? ? ? ? ?// ? var marker = new > OpenLayers.Marker.Label(this.location.toProprietary(this.api), icon, > this.labelText, {mouseOver:true,tooltipsFormat:true}); > ? ? ? ? ? ?// } > ? ? ? ? ? ?// else { > ? ? ? ? ? ?var marker = new > OpenLayers.Marker(this.location.toProprietary(this.api), icon); > ? ? ? ? ? ?// } > ? ? ? ? ? ?return marker; > ? ? ? ?}, > > ? ? ? ?openBubble: function() { > ? ? ? ? ? ? ? ?// TODO: Add provider code > ? ? ? ?}, > > ? ? ? ?hide: function() { > ? ? ? ? ? ? ? ?// TODO: Add provider code > ? ? ? ?}, > > ? ? ? ?show: function() { > ? ? ? ? ? ? ? ?// TODO: Add provider code > ? ? ? ?}, > > ? ? ? ?update: function() { > ? ? ? ? ? ? ? ?// TODO: Add provider code > ? ? ? ?} > > }, > > Polyline: { > > ? ? ? ?toProprietary: function() { > ? ? ? ?var ospolyline; > ? ?var ospoints = []; > ? ?for (var i = 0, length = this.points.length ; i< length; i++){ > ? ? ? ?// convert each point to OpenSpace.MapPoint > ? ? ? ?var ospoint = this.points[i].toProprietary(this.api); > ? ? ? ?var olgpoint = new OpenLayers.Geometry.Point(ospoint.getEasting(), > ospoint.getNorthing()); > ? ? ? ?ospoints.push(olgpoint); > ? ?} > ? ?if (this.closed) { > ? ? ? ?ospolyline = new OpenLayers.Feature.Vector(new > OpenLayers.Geometry.LinearRing(ospoints), null, { > ? ? ? ? ? ?fillColor: this.color, > ? ? ? ? ? ?strokeColor: this.color, > ? ? ? ? ? ?strokeOpacity: this.opacity, > ? ? ? ? ? ?fillOpacity: this.opacity, > ? ? ? ? ? ?strokeWidth: this.width > ? ? ? ?}); > ? ?} > ? ?else { > ? ? ? ?ospolyline = new OpenLayers.Feature.Vector(new > OpenLayers.Geometry.LineString(ospoints), null, { > ? ? ? ? ? ?fillColor: 0, > ? ? ? ? ? ?strokeColor: this.color, > ? ? ? ? ? ?strokeOpacity: this.opacity, > ? ? ? ? ? ?fillOpacity: 0, > ? ? ? ? ? ?strokeWidth: this.width > ? ? ? ?}); > ? ?} > ? ?return ospolyline; > ? ? ? ?}, > > ? ? ? ?show: function() { > ? ? ? ? ? ? ? ?// TODO: Add provider code > ? ? ? ?}, > > ? ? ? ?hide: function() { > ? ? ? ? ? ? ? ?// TODO: Add provider code > ? ? ? ?} > > } > > }); > > -----Original Message----- > From: freyfogle at gmail.com [mailto:freyfogle at gmail.com] On Behalf Of Ed > Freyfogle > Sent: 23 March 2010 14:35 > To: David Whitchurch-Bennett; mapstraction at lists.mapstraction.com > Subject: Re: [Mapstraction] OpenSpace and Multimap in Version 2 > > Hi David, > > best way to get started on v2 is to copy source/mxn.(provider).core.js > to a file names mxn.openspace.core.js and then start making the > functions you need work > > good luck > > Ed > > > 2010/3/23 David Whitchurch-Bennett <david at nmaltd.com>: >> Hi Ed, Andrew and Dylan, >> >> Thanks for the quick responses! >> >> I was interested particularly in OpenSpace which is Ordinance Survey > Mapping >> in the UK. I couldn''t find any source files, so I don''t know if this has >> been started yet. If there are any source files that can be looked at, I''d >> like to try to help, particularly as this works in version 1. >> >> Thanks, >> >> David >> >> -----Original Message----- >> From: freyfogle at gmail.com [mailto:freyfogle at gmail.com] On Behalf Of Ed >> Freyfogle >> Sent: 23 March 2010 13:53 >> To: David Whitchurch-Bennett >> Cc: mapstraction at lists.mapstraction.com >> Subject: Re: [Mapstraction] OpenSpace and Multimap in Version 2 >> >> the project is active, and the software is in use on sites getting >> millions of users. >> >> You can use OSM via cloudmade or openlayers. >> >> Or feel free to contribute your own openstreetmap and/or multimap >> libraries - it''s not that much work to get basic functionality going. >> >> looking forward to your contributions >> Ed >> >> >> >> 2010/3/23 David Whitchurch-Bennett <david at nmaltd.com>: >>> Hi there, >>> >>> >>> >>> I am wondering if this project is still active, and if so, do you know if >>> OpenSpace and MultiMap will be implemented in version 2 anytime soon? >>> >>> >>> >>> Thanks, >>> >>> >>> >>> David >>> >>> >>> >>> _______________________________________________ >>> Mapstraction mailing list >>> Mapstraction at lists.mapstraction.com >>> http://lists.mapstraction.com/listinfo.cgi/mapstraction-mapstraction.com >>> >>> >> >> > > _______________________________________________ > Mapstraction mailing list > Mapstraction at lists.mapstraction.com > http://lists.mapstraction.com/listinfo.cgi/mapstraction-mapstraction.com >