archive-com.com » COM » S » SVENNERBERG.COM

Total: 274

Choose link from "Titles, links and description words view":

Or switch to "Titles and links view".
  • Populating Google Maps with Microformats revisited | In usability we trust
    slider I wanted to be able to easily filter the result by month using a slider Since jQuery UI features a nice Slider I went with that Adding the slider was fairly easy I used the default graphics and just tweaked the slider background a little bit in Photoshop To put the slider in place all that is needed is to add a div with id date slider to the HTML document and the code below date slider slider handle handle steps 3 min 5 max 8 startValue 8 slide function e ui Changing the label to the selected monthname selected month html monthName ui value change function e ui filtering event list filterEventList ui value filtering markers on map filterMap ui value Scrolling the list When you click on a marker in the map the appropriate element in the sidebar list is highlighted When the list is long enough to be scrollable it sometimes means that the highlighted item isn t visible I wanted a way to make the list scroll so the item came into view The jQuery plugin ScrollTo came to the rescue It s a really nice plugin that makes it easy to do just this The syntax is element scrollTo obj Where element is the list and obj is the selected item The files If you want to try the demo and check out the files please use the links below View the Live Demo map js style css My Google Maps book If you found this article useful you might be interested in my book Beginning Google Maps API 3 It covers everything you need to know to create awesome maps on your web sites Buy it on Amazon com Tutorials Google Maps Javascript jQuery Mashups Programming Previous post Report from World Usability Day

    Original URL path: http://www.svennerberg.com/2008/11/populating-google-maps-with-microformats-revisited/ (2016-04-28)
    Open archived version from archive


  • Polylines in Google Maps [Part 2] | In usability we trust
    can you give me an example trackline that causes the problem and I ll take a look Reply Gabriel Svennerberg November 25 2008 at 3 26 pm markw Sure If you contact me through the contact page and give me your email I will mail you a trackline Reply Gabriel Svennerberg November 26 2008 at 1 33 pm The bug is found and fixed It turned out to be a fairly trivial one having to do with escaping of strings Reply Joseph Lust December 10 2008 at 5 23 am Mark fine work with the PHP class but one suggestion to make it much more useful When running storage of map objects in the mySQL Php world the geometric object is splendid as it allows built in functions to be run on your tables of data For instance run SELECT and sort by length or area all from SQL prompt While I like the ability to encode the line and improve loading speed for the client I would of course still store the data in both a geometry object and encoded string If you could add an option to your class that would take a mysql geometry object or linestring and do the rest from there it would make it even more useful in the server environment If not I can still write this for my own implementation but I think others will like it as well Finally if you have nothing else to do what better than pull out your hair and build an SQL SP to achieve encoding Thanks Reply Gabriel Svennerberg December 10 2008 at 8 51 am Joseph That s a good idea I ve actually implemented support for SqlGeometry in the C class for a project I m currently working on where geo data is stored on a SQL Server 2008 But it s not a part of the class I ve made publicly available The reason is that in order to make it work you have to install a few dll s and add extra references to your project so for the sake of simplicity I left it out I haven t done anything like that for the PHP class but it s a great idea I will look into it when I find the time P S Mark has made a C class I ve refactored the PHP code Gabriel Reply dompie December 12 2008 at 9 23 pm Hello you saved me a lot of work with your excellent polylineencoder php class It s awesome fast and works perfect for me thanks a lot for your great effort Reply Gabriel Svennerberg December 13 2008 at 1 11 pm dompie I m glad that you found it useful Reply Timur January 2 2009 at 6 00 pm I very liked this post Can I copy it to my site Thanks in advance Sincerely Your Reader Reply Gabriel Svennerberg January 3 2009 at 4 27 pm Timur I m happy to hear that you like my post Contact me through the contact page with a vaild e mail adress and we can talk about it Reply Anan February 4 2009 at 10 23 am Hi thanks for the excellent work How about the bug fix in 8 I just download the class and it is still there Thanks Reply Gabriel Svennerberg February 4 2009 at 10 49 am Anan Hi The faulty line was still there but commented out Now I have removed it completely Cheers Reply Anan February 6 2009 at 5 52 am Even when I used PointsLiteral I still got incorrect polyline Why To insert correctly into MySQL database you need 4 backslashes not just 2 So I add 2 more and happy now Thanks Reply Tom von Alten February 18 2009 at 11 23 pm In line 22 of your first code example I suppose you mean to have points rather than point as the argument to PolylineEncoder Reply Gabriel Svennerberg February 19 2009 at 7 20 pm Tom von Alten You re absolutely right Thanks for pointing it out I have now corrected it in the code example Reply Will Chapman April 2 2009 at 9 10 pm I have a mysql table with around 8 000 coords representing the 80 canals and navigable rivers of the UK As you can see from http www saveourwaterways info test phtml using the polyline encoder class the ends of each succeeding waterway joins up to the beginning of the next in sequence What I am planning is to draw each of the 80 waterways as a separate polyline but it concerns me that this will mean 80 overlays which suggest to me that it might be sluggish I wondered if anyone has any ideas how I could insert a start and end point to each waterway so I can use just one layer without them merging with each other Cheers Will Reply pracus April 3 2009 at 12 47 pm Hi Do you have any idea what is the reason of such error Parse error syntax error unexpected T ARRAY expecting in home pracus public html minuta pl maps polylineEncoder php on line 69 when trying to display this URL http minuta8 pl maps example php polylineEncoder php file contains exactly the same source as your class file upon no character is changed and example php contains dpEncode header Status 200 header Content Type text html print Encoded points string encoded points Points I don t understand what s wrong Thank you in advance Reply pracus April 3 2009 at 12 48 pm I m sorry It cut a part of example php source before It is Include the file containing the class include polylineEncoder php Create a nested array containing the coordinates points array array 59 6919 17 8582 array 59 3030 18 0395 array 58 9789 17 5341 Create a new instance of PolylineEncoder and supply the array as an argument to the constructor polylineEncoder new PolylineEncoder points Encode

    Original URL path: http://www.svennerberg.com/2008/11/polylines-in-google-maps-part-2/ (2016-04-28)
    Open archived version from archive

  • Polylines in Google Maps [Part 1] | In usability we trust
    time can still be quite long but interacting with the map is a totally different experience Watch the encoded polylines example to see what I mean About the encoding algorithm The encoding algorithm is basically a reduction of unnecessary coordinates at different zoom levels The more you zoom in the more detail is revealed and the opposite around when you zoom out For an in depth explanation of how the algorithm works check out Mark McClure s excellent articles on the subject Description of encoded polylines and An explanation of the algorithm Also read Encoded Polyline Algorithm Format on Google Encode polylines on the server Loading time could still be too long especially in Internet Explorer which has a a notoriously slow Javascript engine To improve on that you should perform the encoding server side In the second part of this article I describe how to do just that using PHP to get dramatically shorter load times Further reading Mark MacClure as I ve already mentioned has written a lot on the subject and also provides several examples so don t miss checking Encoding polylines for Google Maps out Peter Chng has written an article about encoded polylines Playing with Google Maps and encoded polylines that helped clear a lot of my confusion My Google Maps book If you found this article useful you might be interested in my book Beginning Google Maps API 3 It covers everything you need to know to create awesome maps on your web sites Buy it on Amazon com Tutorials Google Maps Javascript Mashups Programming Previous post ASP NET MVC and JSON Next post Bounding Box in Google Maps 26 Comments chris Jangelov October 29 2008 at 1 01 am Excellent posting Thank you chris Reply Pamela Fox October 29 2008 at 11 12 am Cool article Can I link to it from the documentation pamela Reply Gabriel Svennerberg October 29 2008 at 12 50 pm For sure Pamela please do Gabriel Reply Venkat November 4 2008 at 1 33 pm It is really great I need your favour Accuracy is not a big matter for us we have to load large US block groups which may contain around 1 lakhs coordinates It will be great help if you can provide any logic to reduce the coordinates If I use encoder to load 1 lakh BGPs I am afraid it will fail when user zoom in Please help me Thanks Venkat Reply Gabriel Svennerberg November 4 2008 at 4 48 pm Venkat Keep your eyes open for my upcoming article about how to encode a polyline on the server That way you can handle bigger sets of data and dramatically boost load times It should be out in a couple of days or so But considering how much data you have you could probably remove a lot of the coordinates before even starting to encode it P S I had to look up lakh in Wikipedia I didn t know that it means 100

    Original URL path: http://www.svennerberg.com/2008/10/polylines-in-google-maps/ (2016-04-28)
    Open archived version from archive

  • Bounding Box in Google Maps | In usability we trust
    of some sort Reply Gabriel Svennerberg January 19 2009 at 10 19 am Alan There are several ways to do it servers side depending on which language you use In a solution I m currently working on where we use C and SQL Server 2008 I use the SqlGeometry object to handle GEO data I get the data that I want to display on the map as a SqlGeometry object and on that object I then call the method STEnvelope which returns a Bounding Box for the GEO data In the Google Maps API there s the GLatLngBounds class which is a representation of a BoundingBox Some overlays such as GPolyLine and GPolygon has a getBounds method that returns a GLatLngBounds In the case of markers I don t know of any easy way to do it I guess one have to do as you suggest and loop through them all to extract min and max values Reply Aiska January 28 2009 at 12 52 pm Actually you don t have to Define the two corners of the bounding box because it can assign later by using extend var bounds new GLatLngBounds bounds extend GLatLng lat Number lng Number so you have to assign all marker by using this code bounds extend GLatLng lat Number lng Number but sometimes the function of map setCenter bounds getCenter map getBoundsZoomLevel bounds didn t work properly and will returns an incorrect zoom level until now i can t figure out this problem Reply Gabriel Svennerberg January 28 2009 at 1 28 pm Aiska Cool I never thought of that but naturally that s one way to do it Thanks I have never encountered the error you re talking about myself Could be a bug in the API Reply Aiska January 29 2009 at 11 32 am Gabriel Svennerberg yeah that s right maybe this is bugs in API I found new method how to set zoom level of a google map base on markers maybe you can check this out for your reference Thanks Set zoom level of a google map base on markers Reply Gabriel Svennerberg January 29 2009 at 2 59 pm Aiska After looking at your code again it occurred to me that there s a problem in it and that is in how you extend the bound You don t use the new keyword when you create a new GLatLng It should be bounds extend new GLatLng lat lng Maybe that s the reason it doesn t work properly I haven t looked at your new method yet Reply Alex O Byrne February 22 2009 at 1 59 pm If you re getting the lat and long from a collection of Ruby objects Here s the method returns a hash of top right and bottom left bounds def self bounds collection top 0 bottom 0 right 0 left 0 initially set false collection each do point if point lat and point long if initially set or point long top

    Original URL path: http://www.svennerberg.com/2008/11/bounding-box-in-google-maps/ (2016-04-28)
    Open archived version from archive

  • ASP.NET MVC and JSON | In usability we trust
    the XMLHttpRequest object It s through this object that you communicate with the back end Since IE 6 doesn t support this object but do have support for an ActiveX object that essentially does the same thing we initially have to do some checking to make sure that we use the correct object I ve created a wrapper function that with the help of object detection determines which object to use and then returns it function getRequestObject var req false if window XMLHttpRequest req new XMLHttpRequest else if window ActiveXObject req new ActiveXObject Microsoft XMLHTTP return req I use the getRequestObject function to get the correct Request Object and then gets on with setting up the request var request getRequestObject request onreadystatechange handleResponse request open GET Cars GetCars true request send null Note If you re unfamiliar with AJAX and find this code really strange I recommend that you read getting started with AJAX from Mozilla Developer Center Ok so the AJAX Call is all set up The last thing to do is to create the function handleResponse that takes care of the request and the received data function handleResponse if request readyState 4 var cars eval request responseText for each car in cars alert car Name car Color The object is received as JSON text through the responseText property of the request object To convert it to a JSON object you can use the Eval function It will parse the text and produce an object structure This is a fast and convenient way of doing it but be aware of that it has potential security issues Only use it if you know that you can trust the source Otherwise you should use a more robust JSON parser The code in this example will throw an alert for each item

    Original URL path: http://www.svennerberg.com/2008/10/aspnet-mvc-and-json/ (2016-04-28)
    Open archived version from archive

  • Effective Use of Custom Icons in Google Maps | In usability we trust
    myIcons house new GIcon custIcon house png myIcons castle new GIcon custIcon castle png Putting the array to use Later on when you want to place a marker in the map and assign it one of your custom icons you just write this var marker new GMarker point icon myIcons house In the application I m currently building I give the array items the same label as the type they represent So instead of using a huge if else statement to get the right icon I just have to write one line of code where I insert my type as label for the array var marker new GMarker point icon myIcons type Simple effective and elegant My Google Maps book If you found this article useful you might be interested in my book Beginning Google Maps API 3 It covers everything you need to know to create awesome maps on your web sites Buy it on Amazon com Tutorials Google Maps Javascript Mashups Previous post User Controls in ASP NET MVC Preview Release 5 Next post ASP NET MVC and JSON 9 Comments interested December 16 2008 at 6 23 am Sorry for being an idiot but how do you pass the type to the type variable var marker new GMarker point icon myIcons type I have a column in my database that labels e g 1 2 3 locations How do I pass that label to the type variable Thanks in advance Reply Gabriel Svennerberg December 16 2008 at 10 25 am I don t think I understand your question Could you please elaborate Reply interested December 18 2008 at 9 11 pm sorry for the confusion My question was in your posting you said you use var marker new GMarker point icon myIcons type instead of var marker

    Original URL path: http://www.svennerberg.com/2008/10/effective-use-of-custom-icons-in-google-maps/ (2016-04-28)
    Open archived version from archive

  • User Controls in ASP.NET MVC Preview Release 5 | In usability we trust
    want to pass you ll have to use the second way too Passing DataObject to the User Control Like I mentioned earlier in this article the MVC Framework has a useful helper method for inserting User Control into Views It s called RenderPartial Before the Preview Release 5 it was called RenderUserControl and was used a little different So don t confuse the two It s used like this Html RenderPartial Views Cars List ascx To pass a list containing several instances of Car from the View to the User Control is easy You just add it as the second parameter in the RenderPartial call like this Html RenderPartial Views Cars List ascx ViewDataModel or if you explicity assigned it to the ViewData object Html RenderPartial Views Cars List ascx ViewData Cars Displaying the data in the User Control In the User Control you have to first add a reference to the class Car in the CodeBehind And since you want a list of it you have to use List around it public partial class List System Web Mvc ViewUserControl List Car In the ascx you then access the data by referencing to the ViewData Model just like you would in a View So rendering a simple list of cars would look something like this ul foreach Car car in ViewData Model li car Make car Color li ul What s up with the name I find it a little confusing that the Helper method is called RenderPartial when it s actually a User Control that you render Wouldn t it be more logical to call the User Control Partial View or something instead Or have I missed something To read more about the ASP NET MVC Framework and how to pass data objects check out Scott Guthries excellent blog

    Original URL path: http://www.svennerberg.com/2008/10/user-controls-in-aspnet-mvc-preview-release-5/ (2016-04-28)
    Open archived version from archive

  • Imagemap rollover | In usability we trust
    similar at the moment I d also been trying to preserve an accessible version using s but s do the job and are probably more semantic The image map I m working is pretty big so I m going try to also use a background sprite to cut down on the load time ALA stylee http www alistapart com articles sprites Will let you know how I get on combining these ideas R Reply r doll November 3 2008 at 10 58 pm oops that should have said using tags but tags do the job and are probably more semantic also not sure if you re worried about IE6 but seems the positioning is a little off so will see if I can get that sorted too Reply Gabriel Svennerberg November 3 2008 at 11 32 pm I m glad that you found the article useful Also thanks for telling me that one of the overlays positioning was a bit off in IE6 I had completely missed that It s now corrected in the example Apparently there s some extra space at the bottom of the map in IE6 so using bottom as a reference in the CSS wasn t that good On the other hand it was easily fixed by changing the position to be relative to the top instead Using a sprite seems like a smart thing to do I m looking forward to see what you come up with Gabriel Reply Nori February 18 2009 at 1 23 am Hej gabriel Jag har använt ditt sätt för imagemap rollover fast min index sida är i php jag får inte till rollovern att funkar Har testat i ren html och du funkar utmärkt Vet inte riktigt vad felet är Några ideer Om du är intresserad av att hjälpa mig så kan jag lägga in koden Tack Reply em March 26 2009 at 9 37 pm You should be able to add keyboard support fairly easily Add two new events onfocus and onblur and use the mouseover code for onfocus and the mouseout code for onblur I haven t tested this but barring some odd behavior due to the image map it should work I haven t used an image map in YEARS but I m contemplating using one for an upcoming project so thanks for the demo Reply arvind April 9 2009 at 10 36 am i want finland country map by coords method so plz help me thanks Reply MrEnjoy May 14 2009 at 5 40 pm Excellent concept have got this working down to a T with one map However I want to have 3 maps on the same page I have a jist of javascript but can t see how to work round this I want to use the same function but add 2 variables ie var map map1 map2 map3 and then have it run through the funtion checking all 3 maps Possible Each map has a specific id in the css so thats working fine however i cannot get the different maps to rollover Can you help Thanx in advance Reply MrEnjoy May 20 2009 at 3 09 pm Sorted Duplicated the function and modified the var map var amap amap if amap var country list amap getElementsByTagName AREA var bmap bmap if bmap var country list bmap getElementsByTagName AREA There has to be a more elegant way of doing this Cheers Reply Ricardo Santos June 15 2009 at 1 01 pm Hi guys want to ask some question i m putting the refence of DOM to html but nothing happens don t know if i m doing well PARDON MY ENGLISH Reply matt July 30 2009 at 4 07 pm I have no idea how you figured a single pixel transparent gif would solve the flickr issue but thank you for sharing I attempted a few other hacks before finding your solution which worked like a charm Cheers Reply Sune Radich Christensen August 13 2009 at 9 51 am Nice read indeed But the map is not of Scandinavia normally Scandinavia is used to describe Denmark Norway and Sweden and not including Finland Reply kyle bellamy January 26 2010 at 8 40 pm So I ve got the rollover working like a charm thanks to your code work But it is a bit abrupt on the transition Is it possible to add a transition effect to allow them to fade back and forth I ve been looking high and low and found plenty of faders out there but the problem I cannot blend them with the JS that is reading the map and making the transition A particular one I like is Approach Transition It s driving me mad trying to figure out how to add this to the current JS so any helpw would be greatly appreciated Kyle Reply Gabriel Svennerberg February 27 2010 at 12 09 pm Kyle Sorry for being so extremely slow to answer your question but I have now made a new example with a fade effect when the layers are shown and hidden This way the transition isn t so abrupt Reply r doll September 21 2010 at 4 15 pm Hello again Funnily enough I m working on another map and remembered this post and looked back at my old project Then I thought it would suit this new project more if it was in jQuery Thought I d check back here and share my thoughts on a jQuery re write BUT you beat me to it Thought I d add some transitions esp as it s so easy in jQuery again you re already there I realise this is a bit of a pointless comment just seems we were on the same wave length Good work mister R Reply r doll September 21 2010 at 5 41 pm Just a tiny observation of the jQuery fade version I think it might be good to fade the rollovers in so on mouseover country id fadeIn

    Original URL path: http://www.svennerberg.com/2008/09/imagemap-rollover/ (2016-04-28)
    Open archived version from archive



  •