Adding custom pattern overlays on Google Maps - google-maps

I'm currently using Google Maps API and I'm open to try out other free map APIs to accomplish my task.
In one of the projects I'm working on, I need to be able to overlay multiple shape overlay layers on top of one another. My initial thought is to have the first overlay layer to use different shades of solid colors. For subsequent overlay layers, I plan to use different color-coded patterns... ex: the second overlay layer uses color-coded stripe pattern and another overlay layer uses color-coded checkerbox pattern. This way, I can stack these overlay layers to represent multiple things. For the first overlay layer, I'm able to create irregular shape boundaries using Polygon objects and I'm able to set different fill colors on the polygons depending on the associated values.
After digging around, it seems like the Polygon object in Google Maps API only accepts fill and stroke colors, and I don't seem to be able to set custom pattern on a Polygon object. I was hoping it will at least take a PNG pattern file but it doesn't. The closest things I could use is GroundOverlay object but that's not going to work for me because it accepts only 2 coordinates (top left and bottom right, I believe) whereas I need to create custom pattern overlays on irregular shapes.
Can I accomplish this using Google Maps API, or any other map APIs (Bing, Yahoo, etc)? Are there any third party APIs that allow me to integrate custom pattern overlays on Google Maps?

I don't believe any of the APIs you mention support patterned vector shape layers. The two options I can think of are:
To use fill colours that are semi-transparent. Let's say you have a layer that has semi-transparent red polygons, and another layer on top that has semi-transparent blue polygons - the area of overlap between them will be filled with the combined colour (i.e. purple in this case). Bing Maps certainly supports an alpha channel for polygon fills, and I suspect Google Maps does too.
Rather than using a vector shape layer, render your data as raster layers, using whatever fill pattern you want. Cut these layers into 256px x 256px tiles numbered according to the quadkey tile numbering system and place them on the map as custom tile layers. (i.e. the way that the built-in road map and aerial tiles are displayed). If you render your tiles as PNGs, you can stack several layers on top of each other and have transparent (or semitransparent) areas to show through the data in the layers underneath. Depending on what the source of your data is, you might find tools like Mapnik or Geoserver useful to create the tile layers.

If you can live with just a stroke pattern, as opposed to a fill pattern, the latest version of the Bing maps sdk allows you to set the strokeDashArray when creating polygons. Maybe that will suffice for identifying the different shapes you have to overlay on the map.
Hope that helps...

Related

circular overlay projection distortion

I’m currently using the ‘GroundOverlay’ function within a KML file to display an circular image. I know the circle is 48 degrees in diameter, and I want it to look like a circle when I overlay it on the earth. Rather than being a perfect circle though, it’s distorted, most visibly at the poles. I think the reason for the distortion is that GoogleEarth assumes my original image used a map projection, so GE “unprojects” my image, creating the distortion. Is there a way to overlay my circular image as a circle through KML or the maps API by turning off the projection? Or is my only option to project my circular image into a simple cylindrical projection before I call GroundOverlay on it? I'd really prefer the first option if it exists.

what is the difference between overlay map type and layers

From the google map v3 javascript api,I found this:
Overlay Map Types
Some map types are designed to work on top of existing map types. Such
map types may have transparent layers indicating points of interest,
or showing additional data to the user. (Google's traffic layer is an
example of such a map type.)
Which say that Google's traffic layer is an example of such a map type.
But the traffic layer is intance of Layer in google map.
So I am confused with the concept.
Since we are build our own map library for offline use,so I want to refer google's concept and their idea.
Any one can give me more details?
Layers and Overlays are not of the same type.
Layers can only be manipulated as a whole object. I guess google dont want you to mess with the information.
Layers thought of as a type of map type for selection, and are transparent. They are also sort of like the concept of an overlay as they are made of geometric shapes.
i think the concept is confusing because overlays, layers and the underlying map type are all things that in other systems (photoshop for example) would just be layers (that might be of different type (ie vector or raster).
Hope this helps.

Overlay 10K polygon SVG on Google Map (existing answers don't work)?

How do I overlay an SVG with 10K polygons on google maps? Notes:
Drawing 10K polygons client-side is painfully slow.
Converting to kmz and using as a KML layer fails because of Google
Map's limits on KML filesize and/or number of polygons.
My current solution is converting pieces of the SVG to PNG on
demand. This works, but
is slow, even for the very simple SVG I parse there (the example
doesn't have 10K polygons, just an example of the SVG -> PNG
technique). Source code for SVG -> PNG thing: https://github.com/barrycarter/bcapps/blob/master/bc-mytile2.pl
Is there a better way? I know there are other answers to this problem
here, but I believe they use client-side drawing or Google Map's KML
layer, neither of which would work for me here.
EDIT: I realize caching may help some, but I can't cache every single tile, and my sense is that people browsing will zoom in on different parts of the world.
Generate and cache png map tiles for low zoom levels. On higher zoom levels, overlay polygons client side, but process/download visible polygons only. Consider reducing number of polygon points depending on zoom level.

How does Google StreetView recognize 3D planes?

Inside Google Street View, moving the mouse around over different buildings and stuff, it highlights the 3D plane in which that surface of the building is located.
How does it recognize this thing? Is it done automatically by machine algorithms, or manually in the preprocessing?
Read this to get your answer. What Google does is it gets a panoramic view by stitching multiple images together, and then the device measures the relative distance of every object around it (through lasers), and constructs a 3D model of the surroundings based on that.
You want to look into space-filling-curves. A sfc reduce the 3d complexity to a 1d complexity. A sfc subdivide the 3d space into 8 tiles thus it resemble an octree.

Using google maps API or OpenLayer to render a large non-map image

I have a large non-map image that I want to allow people to view on a browser at multiple zoom levels. I want to display the image in google maps API or openlayer so that people can zoom in/out and pan. I was hoping i could then add additional layers to overlay things of interest on the image. I am looking at MapTiler to chop the image up into tiles that can be generated at multiple zoom levels, but I'm getting very confused...
MapTiler wants to know about the spatial reference system (SRS) for georeferencing of my my image files, and well I don't know what I'm supposed to tell it ;) I have no georeference data - I just want it to generate tiles for my image, and then allow me to display that image in google maps or openlayer. In addition, openlayers seems very dependant on georeference data..
Am I looking at the wrong solution, or are there any pointers to getting this to work? Can OpenLayers be used to display a custom set of image tiles at multiple zoom levels without georefence data?
Found the answer. It is possible in both OpenLayers and Google maps to display a custom map, providing your own tiles for the map...
This google groups posting details how you can use MapTiler to generate non-georeferenced images, which can then be shown on a OpenLayers image.
In MapTiler, you need to choose rastor image and then ensure that you don't add any georeferencing data to the image with MapTiler.
If i get this right maybe google maps custom overlays will fit your needs?