Subway lines in KML with different colors on one track? - google-maps

My first KML project was an animated map of the Washington DC Metro system (see Animating Metro with KML and Google Earth). Unfortunately, where Metro lines share the same track, only one color prevails. The real map shows a wider line with both colors side by side.
Is there a way to draw a line in KML (Google Earth) with two side-by-side colors? I've seen a way to have a different color on the edges of the line, but that's different.
I could cheat by changing the coordinates of each station, but aside from computational difficulties, I'd have to continuously changes to positions every time the user zooms, to prevent a gap between colors (or an overlap).
Other subway systems show more than two colors running alongside each other, so an option to show multiple colors would be nice. And this is not really a gradient, as the colors don't fade together; they should be distinct, assuming the pixel width is wide enough.
This is probably a feature request, though surely someone else has run across this problem before Google Earth v6? Would love to be able to do this, or find a good workaround in the interim.
Michael
http://www.mvjantzen.com/blog/

The short answer is no, although you could probably create a custom MVC object that renders the line for you as desired (i.e. you would not need to alter the Kml)
http://code.google.com/apis/maps/articles/mvcfun.html
That said, your cheat method could work too - and I would disagree that
"...I'd have to continuously changes to positions every time the user
zooms, to prevent a gap between colors"
You can set the <gx:physicalWidth> property which allows you to set the width of a LineString to be in meters, rather than pixels.
https://developers.google.com/kml/documentation/kmlreference#gxphysicalwidth
In the case of your track example, this means you can set the width of the track to match the underlying imagery no matter what altitude the end user views it from.

Related

Changing Maps "detail/resolution" while still zooming in/out

I'm toying around with d3.js and some other javascript libraries plotting geoJSON data in the browser. I've done some cool things with the data, but to give it a bit more context I want to lay it over a map that fills the browser (i'll probably make it opaque to not distract). I've spent a few hours with the google and bing API, which have great "zoom" options, but I want to specify how detailed the map becomes without further restricting how far I can zoom in. Is there a way to do this? I.e. I want to zoom further in and be able to pan around, without all of the side streets appearing-- maintaining the "main drags" of the city I'm working with.
I'm open to using different resources, but this is not a commercial product so I don't want to pay anything. As far as I know, the option for increasing and decreasing the detail/resolution of the pane is by increasing or decreasing the zoom variable. Thanks.
Edit: There really doesn't need to be much interaction with the map. This is kind of the intention http://www.caudillweb.com/temp/d3_choropleth.html, but since it will be at the city level, as you can see when you zoom in that far all sorts of different elements and side streets appear, taking away from the clean view at a more zoomed-out level and it begins to distract from the data.

open earth map with irregular station measurement overlays

I would like to draw a map of current temperatures (or air pressures, etc.) from many weather stations, with the underlying map still recognizable. the problem is easiest to think of as follows:
I have an array of spot measurements from irregularly spaced dots---think triples of GPS coordinates with one temperature value each. my stations can be very close to or very far apart from one another, and a user may want to zoom in or out. cold should be blue, warm should be red. Ideally, I would like to just pass the array, the color range, and have the rest be taken care of. I would prefer everything to be inside a web browser. The user needs to be able to zoom in, zoom out, move around, and get back to his current location.
I do not even know how to think about this problem. If a user has zoomed out enough, non-transparent dots could be so close as to obscure the terrain. However, zooming in, it would be nice to recognize the dot that is the station itself. This presumably requires some intelligence that realizes how many dots there are, e.g., relative to the density of the display? not sure.
I believe google maps charges for many API calls, so I would prefer using an open map and/or open API that can use different underlying maps. It does not have to be fancy. I don't care about directions, etc.---just a map that is recognizable at most zoom settings, with landmark and street names, and my nice temperature station overlay coloring, so that a user can visualize where it is cold and where it is warm.
(Stations come online and offline, but I don't need to update this more than once an hour. I can place the map measurements into a file that is URL web-accessible.)
is this an easy or a hard problem for the high-level web programmer?
/iaw
after looking around for a long time, I think the best way to do this is with html5 openlayers nexrad.
alas, the docs seem to be a mess. half the examples that I found did not seem to work. it's pretty hit-or-miss. similarly, the openlayers cookbook also seems to be outdated and has incorrect examples, but they did have a reasonably short example of such a nexrad map overlaid on the U.S., that one can further study.

programmatically create Background Images in Flex 3

I'm developing a visualization for certain parts of a Warehouse with Flex 3. In this visualization there are lot of blocks where 1 to x pallets can be placed where x is between 9 and 15. I need to represent each pallet with a black square, each place which is already assigned to a pallet but not physically taken with a grey square and each free place with a white square. I first thought to just use a canvas for each place on a block and change their color if the state changes. But the hundreds of canvases which are there as a result of this approach are not updated quickly enough for my purposes (screen freezes for a few seconds).
I don't want to use embedded images because of the great amount of images I had to embed in the application (those Images appear in 4 orientations).
My idea was to create background images which reflect the state of the whole block only when needed for that certain state and cache them, so that the computation time is spread over the whole runtime.
My problem now is I don't know how to create them in a way that I can use them as "backgroundImages". As far as I understand I would need them as a class object but I don't know how to achieve that, when not embedding the images.
I'm of course open to better approaches to solve my problem. Thanks for your support.
I would suggest using Graphics property of a Sprite for example. It provides basic drawing API, like drawing lines, circles and rectangles.
Besides, you can draw bitmap images on the Graphics to produce more advances results.

Advice on techniques for recognising land/sea mass in google maps

I am looking to develop some code that will be able to by looking at images downloaded from google maps, categorize which part of the image depicts the land and which part depicts the sea.
I am a bit of a newbie to computer vision and machine learning so I am looking for a few pointers on specific techniques or API's that may be useful (I am not looking for the code to this solution).
What I have some up with so far:
Edge detection may not be much help (on its own). Although it gives quite a nice outline of the coast, artefacts on the surface/above the sea may give false positives for land mass (stuff like clouds, ships, etc).
Extracting the blue colour element of an image may give a very good indication of which is sea or not (as obviously, the sea has a much higher level of blue saturation than the land)
Any help is of course, greatly appreciated.
EDIT (for anyone who may want to do something similar):
Use the static google maps API to
fetch map images (not satellite
photos, these have too much
noise/artefacts to be precise).
Example url-
http://maps.google.com/maps/api/staticmap?sensor=false&size=1000x1000&center=dover&zoom=12&style=feature:all|element:labels|visibility:off&style=feature:road|element:all|visibility:off
To generate my threshold images I used the Image processing lab. I would apply the normalized RGB -> extract blue channel filter and then apply Binarization -> otsu threshold. This has produced extremley useful images without the need to fiddle with thresholds values (the algorithm is very clever so I won't muddy the waters and attempt to explain it)
I assume you are using the satellite view images from Google Maps otherwise you wouldn't have written about ships or other artefacts.
As you already said it might be a good idea to simply try to extract the blue image part.
Just having a look at the blue channel of an RGB image isn't going to work (I just tried), since the woods and so on will not give a good threshold value on the water.
So you can try converting the image to YCbCr color space and have a look at the chrominance channels there.
This an example I just made with a screenshot from google maps. I converted it to YCbCr in Matlab and just took the Cb channel.
You can then binarize this image by a well set threshold, which shouldnt be too hard to find.
You probably will still have small artefacts for which you could use morphological operators (Opening the image several times).
This should remove small artefacts and leave the parts that are land and the parts that are water.
Hope it helps... if not, please keep asking...
EDIT
I've just tried again with another screenshot in matlab:
Convert Image to YCbCr colorspace
Just have a look at Cb channel
find threshold on Cb image either fixed or by i.e. Otsu's method which finds an appropriate thresholdl in a bipartite histogram
perform opening or other filters to eliminate small noises
The original image I made:
After applying a threshold on the Cb image:
After applying an opening (5) on the image
I just picked a threshold manually... You might get better results by having a look which threshold would work better... But as you see this should also work on the different colors of water from rivers and ocean.
You are looking for a segmentation algorithm, that assigns each pixel to one of two classes (land, sea). One of the simplest approaches is to use thresholding.
define a threshold t
if pixel value > t -> assign pixel to land
else assign pixel to sea (usually you will have a bitmap, where you keep track of the pixel class)
Since this approach works best if you can distinguish land and sea masses easily, I would suggest that you compare the hue value of the pixels (i. e. find a threshold between blue and green).

Obfuscating Geocode results to protect privacy?

I have an app that finds other users within a 20 mile radius on a google map and associates an icon with each of them. However, I do not want their exact points to be given but rather an approximation. I've wrestled with a few ideas on how to do this:
Only Geocode the Zip Code, make graphic icons for 1-99, use the icon to represent how many results are within the zip code, and use the info window to show hyperlinks to the individual results. The only problem is, I'd like each individual icon to be shown because it just looks a lot better.
Add/Subtract a random number to the lat/lng values stored with each user and add a translucent circle around the icon.
What do you guys suggest?
It depends on the level of privacy you want (the 1st option protects privacy better), but I'd be tempted to go with randomly moving the indicators because it's a more natural representation (people on a map, not groups of people on a map) without too much of a compromise in terms of usefulness.
That depends on how hard you think someone will try to defeat your system.
If you plan to track these positions over time, you give away more information over time than you do in a snapshot. For instance, if you choose a fixed-offset from the center of the circle, it may be possible to find this offset by mapping the path over time to the street map. On the other hand if you continually change the offset, the position may be discoverable by averaging.
Here's one possible scheme based on hysteresis. Leave the visible circle in place until the user exits an invisible bounding circle with a random radius. Then compute a new visible circle with a different random offset, and also set up a new invisible circle with a different random radius. This should generate a visible-circle movement that is almost impossible to reverse engineer, but also avoids lots of jittery movement.