Results 1 to 3 of 3

Thread: Google Map w/text markers.

  1. #1
    Sencha User
    Join Date
    Feb 2012
    Location
    Illinois
    Posts
    97
    Vote Rating
    2
      0  

    Default Google Map w/text markers.

    So I've been fighting for a while with google maps and kml's. In the end it turns out that google does not provide as a part of their api a way to attach a label to a point if you are requesting that they parse your kml into a google layer. (Sorry if that didn't make much sense...it's late)

    In the end I think this is how I'm going to come about my solution.

    Code:
    		var googleMap = this.getTheMap().getMap();
    
    
    		var latlng = new google.maps.LatLng(40.4587914, -90.7151437);
    
    
    		var image = new google.maps.MarkerImage(
    				'/MyApp/resources/images/texxxt.png', new google.maps.Size(
    						100, 20));
    
    
    		var marker = new google.maps.Marker({
    			position : latlng,
    			map : googleMap,
    			icon : image
    		});

    Feels hacky and way more heavyweight than google just reading the name attribute of my kml item and dropping it onto my point like it apparently does for something similar. Plus now I have to create a text png for 60+ items....boo.

    Let me know if you have a better way!

  2. #2
    Sencha User
    Join Date
    Feb 2012
    Location
    Illinois
    Posts
    97
    Vote Rating
    2
      0  

    Default Better Solution

    Found this article and modified the solution a little to fit my needs. This is a much better way to add text to a marker than providing text as an image.

    http://blog.mridey.com/2009/09/label-overlay-example-for-google-maps.html

    A
    ny one have a good solution for creating a marker w/out a marker?

  3. #3
    Sencha User
    Join Date
    Feb 2012
    Location
    Illinois
    Posts
    97
    Vote Rating
    2
      0  

    Default

    I did some really quick/basic testing and created 100k markers w/a 1x1 transparent png and got better results than by creating 100k markers w/an invalid image reference.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •