Related to an earlier Q of mine replied-to by Andrew Turner: Target - a "Hello World" level script that is OSS only (Openstreetmap and OpenLayers <http://www.openlayers.org/api/OpenLayers.js>). The below snippet results in a "GMap2 is undefined" complaint. Will appreciate any help in resolving this without including the GMap API. Thanks, all. <script type="text/javascript" src=" http://www.openlayers.org/api/OpenLayers.js"></script> <script type="text/javascript" src=" http://mapstraction.com/mapstraction-js/mapstraction.js"></script> <script type="text/javascript"> var mapstraction = new Mapstraction(''mapstraction'',''openstreetmap''); var myPoint = new LatLonPoint(39.00,-76.63); mapstraction.setCenterAndZoom(myPoint, 10); mapstraction.addControls({ pan: true, zoom: ''small'', map_type: true }); </script> -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.mapstraction.com/pipermail/mapstraction-mapstraction.com/attachments/20091004/e2812269/attachment.htm>
it looks to me like you need to include the google maps library and api key. ie something like <script type="text/javascript" src="http://maps.google.com/maps?file=api&v=2&key=ABQIAAAA3YV0H9olZo5q0xk-KzYFxBRofKMe1jpwl7QjoAeMFUp12HVTSRRtYJwbxsHB9EBm9EMlue2rmuCoWA"></script> (use your own key). My advice to you would be to use mxn v2 though, not v1. ciao, Ed On Sun, Oct 4, 2009 at 17:15, Arnie Shore <shoreas at gmail.com> wrote:> > Related to an earlier Q of mine replied-to by Andrew Turner: > > Target - a "Hello World" level script that is OSS only (Openstreetmap and OpenLayers).? The below snippet results in a "GMap2 is undefined" complaint. > > Will appreciate any help in resolving this without including the GMap API.?? Thanks, all. > > ??? <script type="text/javascript" src="http://www.openlayers.org/api/OpenLayers.js"></script> > ??? <script type="text/javascript" src="http://mapstraction.com/mapstraction-js/mapstraction.js"></script> > ??? <script type="text/javascript"> > ??? ??? var mapstraction = new Mapstraction(''mapstraction'',''openstreetmap''); > ??? ??? var myPoint = new LatLonPoint(39.00,-76.63); > ??? ??? mapstraction.setCenterAndZoom(myPoint, 10); > ??? ??? mapstraction.addControls({??? pan: true,??? zoom: ''small'',??? map_type: true??? }); > ??????? </script> > > > _______________________________________________ > Mapstraction mailing list > Mapstraction at lists.mapstraction.com > http://lists.mapstraction.com/listinfo.cgi/mapstraction-mapstraction.com >
I haven''t tried your code, but I think you need to make ''openlayers'' your provider instead of ''openstreetmap'' OpenLayers will load OpenStreetMap tiles by default. See here: http://mapstraction.appspot.com/#openlayers --- Adam DuVander I like maps: http://mapscripting.com I like simple: http://adamduvander.com On Oct 4, 2009, at 9:15 AM, Arnie Shore wrote:> Related to an earlier Q of mine replied-to by Andrew Turner: > > Target - a "Hello World" level script that is OSS only > (Openstreetmap and OpenLayers). The below snippet results in a > "GMap2 is undefined" complaint. > > Will appreciate any help in resolving this without including the > GMap API. Thanks, all. > > <script type="text/javascript" src="http://www.openlayers.org/api/OpenLayers.js > "></script> > <script type="text/javascript" src="http://mapstraction.com/mapstraction-js/mapstraction.js > "></script> > <script type="text/javascript"> > var mapstraction = new > Mapstraction(''mapstraction'',''openstreetmap''); > var myPoint = new LatLonPoint(39.00,-76.63); > mapstraction.setCenterAndZoom(myPoint, 10); > mapstraction.addControls({ pan: true, zoom: > ''small'', map_type: true }); > </script> > > _______________________________________________ > Mapstraction mailing list > Mapstraction at lists.mapstraction.com > http://lists.mapstraction.com/listinfo.cgi/mapstraction-mapstraction.com
Correct - if you use OpenLayers as the provider, the tiles are OpenStreetMap by default. This is the entire "OSS" solution. Alternatively, and where you''re probably confused, was that the old "openstreetmap" provider was just GoogleMaps with OSM tiles. That doesn''t really make sense (all the same functionality) as a separate provider (OSM is just data). So if you could use the ''google'' provider and then add the OSM addTileLayer as I mentioned previously. Andrew On Sun, Oct 4, 2009 at 1:18 PM, Adam DuVander <mapstraction at duvander.com> wrote:> I haven''t tried your code, but I think you need to make ''openlayers'' your > provider instead of ''openstreetmap'' > > OpenLayers will load OpenStreetMap tiles by default. See here: > http://mapstraction.appspot.com/#openlayers > > --- > Adam DuVander > I like maps: http://mapscripting.com > I like simple: http://adamduvander.com > > On Oct 4, 2009, at 9:15 AM, Arnie Shore wrote: > >> Related to an earlier Q of mine replied-to by Andrew Turner: >> >> Target - a "Hello World" level script that is OSS only (Openstreetmap and >> OpenLayers). ?The below snippet results in a "GMap2 is undefined" complaint. >> >> Will appreciate any help in resolving this without including the GMap API. >> ? Thanks, all. >> >> ? ?<script type="text/javascript" >> src="http://www.openlayers.org/api/OpenLayers.js"></script> >> ? ?<script type="text/javascript" >> src="http://mapstraction.com/mapstraction-js/mapstraction.js"></script> >> ? ?<script type="text/javascript"> >> ? ? ? ?var mapstraction = new >> Mapstraction(''mapstraction'',''openstreetmap''); >> ? ? ? ?var myPoint = new LatLonPoint(39.00,-76.63); >> ? ? ? ?mapstraction.setCenterAndZoom(myPoint, 10); >> ? ? ? ?mapstraction.addControls({ ? ?pan: true, ? ?zoom: ''small'', >> ?map_type: true ? ?}); >> ? ? ? ?</script> >> >> _______________________________________________ >> 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 >-- Andrew Turner mobile: 248.982.3609 andrew at fortiusone.com http://highearthorbit.com http://geocommons.com Helping build the Geospatial Web Introduction to Neogeography - http://oreilly.com/catalog/neogeography
I''m trying to use the demo page as recommended, but am 404''ing on the first one below. Then I wind up with mxn undefined. Thanks for any help here, guys. ~ AS <script type="text/javascript" charset="utf-8" src=" http://maker.codiv.dev.fortiusone.local/javascripts/embed.js"></script> <script src=" http://code.google.com/p/mapstraction/source/browse/trunk/source/mxn.js" type="text/javascript"></script> <script src=" http://code.google.com/p/mapstraction/source/browse/trunk/source/source/mxn.core.js" type="text/javascript"></script> <script src=" http://code.google.com/p/mapstraction/source/browse/trunk/source/source/mxn.geocommons.core.js" type="text/javascript"></script> -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.mapstraction.com/pipermail/mapstraction-mapstraction.com/attachments/20091004/c7c06c82/attachment.htm>
Those links are to HTML views of the source code. If you want to link to the Raw file use: http://mapstraction.googlecode.com/svn/trunk/source/mxn.js Also - right now you don''t need to manually include Core or OpenLayers or GeoCommons. Just do: <script src="http://mapstraction.googlecode.com/svn/trunk/source/mxn.js?(openlayers,geocommons)" type="text/javascript"></script> And that will include all the JS files you need. Look in the test/index.html or the examples/ directory for more up to date examples on how to use V2. On Sun, Oct 4, 2009 at 6:44 PM, Arnie Shore <shoreas at gmail.com> wrote:> I''m trying to use the demo page as recommended, but am 404''ing on the first > one below.? Then I wind up with mxn undefined. > > Thanks for any help here, guys. ~ AS > > ??????? <script type="text/javascript" charset="utf-8" > src="http://maker.codiv.dev.fortiusone.local/javascripts/embed.js"></script> > ??????? <script > src="http://code.google.com/p/mapstraction/source/browse/trunk/source/mxn.js" > type="text/javascript"></script> > ??????? <script > src="http://code.google.com/p/mapstraction/source/browse/trunk/source/source/mxn.core.js" > type="text/javascript"></script> > ??????? <script > src="http://code.google.com/p/mapstraction/source/browse/trunk/source/source/mxn.geocommons.core.js" > type="text/javascript"></script> > > > _______________________________________________ > Mapstraction mailing list > Mapstraction at lists.mapstraction.com > http://lists.mapstraction.com/listinfo.cgi/mapstraction-mapstraction.com > >-- Andrew Turner mobile: 248.982.3609 andrew at fortiusone.com http://highearthorbit.com http://geocommons.com Helping build the Geospatial Web Introduction to Neogeography - http://oreilly.com/catalog/neogeography
Andrew thanks - it''s appreciated. I''m getting the folg complaint now: ~~~~_/)~~~~~~_/)~~~~~~_/)~~~~~~_/)~~~~~~_/)~~~~~~_/)~~~~ Message: ''Maker'' is undefined Line: 8 Char: 13 Code: 0 URI: http://mapstraction.googlecode.com/svn/trunk/source/mxn.geocommons.core.js ~~~~_/)~~~~~~_/)~~~~~~_/)~~~~~~_/)~~~~~~_/)~~~~~~_/)~~~~ Out of the folg script: ~~~_/)~~~~~~_/)~~~~~~_/)~~~~~~_/)~~~~~~_/)~~~~~~_/)~~~~~~_/)~~~ <script src=" http://mapstraction.googlecode.com/svn/trunk/source/mxn.js?(openlayers,geocommons)" type="text/javascript"></script> </head> <body> <div id="mapstraction" style="position:relative; height: 400px; width:600px"></div> <script type="text/javascript"> var mapstraction = new mxn.Mapstraction(''mapstraction'',''geocommons''); mapstraction.addOverlay("4"); </script> <div> <script type="text/javascript" charset="utf-8"> getCenter = function() { var center = mapstraction.getCenter(); alert(center.lat + " " + center.lon); } On Mon, Oct 5, 2009 at 8:38 AM, Andrew Turner <andrew at highearthorbit.com>wrote:> Those links ... >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.mapstraction.com/pipermail/mapstraction-mapstraction.com/attachments/20091005/c3be3af2/attachment.htm>