Visible zoom level for GroundOverlay in KML? - kml

First off, I apologize if this is a novice question and/or if it has been asked already. I'm new to KML and so far, searching for 'GroundOverlay' and 'zoom' hasn't helped me.
I have created a KMZ file from an ESRI ArcGIS Layer. The KMZ includes a GroundOverlay (which is a PNG image). The KMZ opens and works fine in Google Earth, but now I would like to limit its visibility. My data is for the continental 48 US States and is meant to be viewed as such. So, zooming in to a 500-mile eye alt in Google Earth doesn't do the user any good. Is there a setting for GroundOverlay that turns its visibility off when the user is zoomed in to a specific level in Google Earth?
Thanks!

Making features visible in Google Earth when you're zoomed in/out can be controlled by adding a Region to your GroundOverlay. Same concept works for any KML Feature (i.e., Document, Folder, Placemark, GroundOverlay, NetworkLink, etc.)
You can simply add a Region to your GroundOverlay with maxLodPixels value to make it disappear when you're zoomed in. A more advanced setup could have smaller region-sized image overlays rather than a singe continent-sized overlay where each GroundOverlay has a Region for when when that overlay is visible. The visibility of the Region is defined when the bounds of the region (via LatLonAltBox) with respect to a minimum or maximum pixel size.
Note, however, that Google Earth won't let you create or edit a Region on a GroundOverlay directly so you'll need to add that to your KML outside of Google Earth. This and other limitations in Google Earth are listed here.
To get a feel for pixel sizes on the screen and create appropriate minimum pixel size (minLodPixels) and maximum size (maxLodPixels) you can measure the "screen" pixels dimensions with the KML screen ruler. Click "Raw" link to view raw KML then save locally and launch in Google Earth.

Related

Convert a Google Earth kml to a Google maps kml - Using image overlays

I have created a kml file with Google Earth that creates an overlay using an external image. It works well, and I would like to find a reasonably convenient way of converting the kml so that Google Maps can read it and display it in a similar fashion.
Google Maps cannot process Google Earth coordinates, so I attempted to convert them myself. For instance I replaced the Earth Coordinates:
<gx:LatLonQuad>
<coordinates>
-80.34344837780532,33.1105864538138,0
-80.31934785561177,33.09410014458361,0
-80.30034967982111,33.11373571527255,0
-80.32473786478347,33.13044135685429,0
</coordinates>
</gx:LatLonQuad>
with the equivalent Maps coordinates:
<LatLonBox>
<north>33.13044135685429</north>
<south>33.11373571527255</south>
<east>-80.31934785561177</east>
<west>-80.34344837780532</west>
</LatLonBox>
Unfortunately, the are not exactly "equivalent". The Maps overlay is slightly off and rotated incorrectly.
Here are the images from the two:
Earth Example
Maps Example
I can see why it doesn't work, but I'm at a loss as to another solution. Anyone know of a simple way to convert a Google Earth kml to a Google Maps kml when an image overlay is involved?
Per the KML reference a <LatLonBox> also has a rotation. Not sure if that is supported for Google Maps, but it should address the issue you are having. The <gx:LatLonQuad> allows you do specify a rotated box (which is what you are doing), this is what that specifies:
http://www.geocodezip.com/geoxml3_test/v3_geoxml3_kmltest_linktoB.html?filename=http://www.geocodezip.com/geoxml3_test/GoogleEarthPolygon.kml
According to the KML reference for Google Maps, LatLonBox is supported, rotation is not:
KML Element Supported in Google Maps?
<LatLonBox> yes
<rotation> no
therefore you need to make your overlay align on north/south east/west boundaries (a non-rotated LatLonBox) to work on Google Maps.
You have a problem with your computed LatLonBox (the small blue box), you want the green box:
http://www.geocodezip.com/v3_GoogleEx_layer-kml_linktoB.html?filename=http://www.geocodezip.com/geoxml3_test/GoogleEarthPolygonA.kml
I think the only way to fix this is to take your original image rotate it and save an image aligned on north/south east/west boundaries that fits in the bigger box.
Either that or make a custom overlay that supports rotation somehow.

Stop dimming / color change of overlapping placemarks on Google Earth

I'm using Google Earth to display point data as placemarks. The data is on a color-coded scale, and so it's pretty important that they keep their colors (which are set via a series of differently colored icons)
However, Google Earth seems to have a 'feature' whereby it dims some placemarks if they overlap. I can find no reference to this feature, nor any way to avoid it, turn it off, using KML or otherwise.
The question was originally asked here:
https://groups.google.com/a/googleproductforums.com/forum/#!topic/earth/DTl6yGLvPvw
Where there are also screenshots of the problem.
Thanks!

Incorrect coordinates retrieved from image using ABBYY OCR SDK

I'm trying to process an image using ABBYY OCR SDK using the sample code placed in this question but I'm not able get the co-ordinates right for a specific word say "OCR" on the screenshot below.
I want to draw an overlay (yellow rectangle over the word "OCR") and sometimes the rectangle is placed very far away from the actual word.
The XML you get is synthesised according to this schema.
For each recognized character it will contain an instance of charParams element as shown in the answer you linked to. The element will contain the coordinates in page pixels - the same XML also contains a page element:
<page width="..." height="..." resolution="..." originalCoords="...">
where the image width and height are stored. So l and r for each charParams element is in range 0..width-1 of the corresponding page and t and b for each charParams element is in range 0..height-1 of the corresponding page.
Also it's worth mentioning explicitly that all coordinates are in pixels - they are completely resolution-agnostic. This is why whenever you try to highlight anything on an image you have to take zoom into account - the image will likely not be always displayed as is by your device software, but will be downscaled and so you have to map page coordinates onto your zoomed-out image coordinates and highlight appropriately.
Have you checked the DPI of the original image and also check the documentation to make sure the OCR engine is using the same DPI and not returning the image in points or some other measurement system.
It could be that rectangle you are drawing in iOS is not based on pixels but on some other measurement system also.
You just need to work through the process, testing as you go, and work out where the problem is coming from. It is most likely a uniform scaling and the distance from the actual word is proportional to the distance of the word from the top left of the page.

how to make a Sprite

ive used an online srpite service http://spritegen.website-performance.org/ but i want to know how to make them by myself.
How can i save an image that it should be so small but when used on my web site it comes out normal size?
Sprites aren't about making the image itself small, it's about decreasing filesize by packing several images into one.
Take a look at Yahoo's icon sprite. Notice that they have all their section icons stacked vertically in one large image. They then use CSS to position the background to only show a small window of the sprite image, thus giving you just the icon.
In the end, it's up to you how you arrange your sprite. Check out the bottom of Amazon's sprite.
Either way, hopefully that helps gives you a better idea of the concept of sprites.
From the very site you link:
CSS sprites are a way to reduce the
number of HTTP requests made for image
resources referenced by your site.
Images are combined into one larger
image at defined X and Y coorindates.
Having assigned this generated image
to relevant page elements the
background-position CSS property can
then be used to shift the visible area
to the required component image.
So there is nothing magical involved: you simply need to pack all your pictures into a single giant image with your favourite graphics tool and insert them as CSS background. Just look at this CSS sprite by Google:

Are there other options of enabling an irregular shaped clickable area on a web page other than image maps?

(This is a post that I'm moving from ui stackexchange.)
We have some irregular shaped areas...imagine a map of the states of the US. Imagine also that inside each state there is a rectangular region that contains graphics and text. We want to make each of the states react to mouseover/mouseout/click.
If it is a straight up HTML/Javascript page (no Flash), are there other ways to implement this than image maps?
If this is not possible, I would also consider just having the rectangular region within each state react to mouse events.
Does "straight up HTML" mean you can use Javascript? If so, consider the Raphael javascript library, which wraps SVG. Check out their homepage for a great overview of what you can do, including this example of counties (?) of Australia: http://raphaeljs.com/australia.html
You could also consider processing.js, which is a similar visualisation library but wraps canvas as opposed to SVG.
how about coordinates? grab your map of the us, figure out the polygons that contain a state, and every time the user clicks somewhere, get the position of the click and figure out what polygon that position is in.
the only tricky part is doing the translation from logical to physical. i.e. when you get the location of a click it'll probably give you the location in global browser positioning, and you'll need to figure out where your image is using jquery's .position().

Resources