how to convert Microsoft Map LocationRect to Edges - bing-maps

Microsoft.Map.getBounds() returns LocationRect object, which it self consist of center,width, height.
i want to find left-top and bottom-right edges to query my database to brings all points in that area.

The LocationRect class includes a GetNorthwest() and GetSoutheast() functions. You can check the reference here

Related

AEM6.4: Meaning of values in image map properties

AEM offers a plugin to create image maps for its internal inplace editor. After configuration the given values are stored into follow forrmat:
[rect(89,92,356,368)"/content/sites/we-retail/us"|"_blank"|"fdfdfdfdf"|(0.2,0.2004,0.8,0.8017)]
The first paratheses are defines the coordinates of choosen shape.
The content within the first quotaion signs defines the target site, within the second how to open it the browser. In the third pair of quotations sign contains an alternative Text for non images display.
What I don't know are the values in second paratheses. Does someone know for what these values stands for?
From the WCM core components Image model, they are called relative coordinates.
They are not standard HTML attributes and are instead populated as data attributes of the area tag within the image component.
See code below:
<area shape="${area.shape}" coords="${area.coordinates}" href="${area.href}"
target="${area.target}" alt="${area.alt}" data-cmp-hook-image="area"
data-cmp-relcoords="${area.relativeCoordinates}">
Since the map coordinates are fixed coordinates and do not change when the image scales in or not based on screen sizes, the image component’s JavaScript uses this relative coordinates data to adjust the coordinates of the map area whenever the image size is adjusted. This is handled by the resizeAreas() function within the component’s clientlib.

How to overlay Long/Lat points on a existing map

I have an existing map of ward in Chicago in Tableau:
I have a separate CSV file, linked to primary data source by Ward. It contains pairings of Long/Lat points. I can make a map of it by itself, but cannot find a way to place the points on this map. How would I do that?
If you want to overlay the dots to the existing area map you will need to use dual axis. Steps to follow are:
drag latitude (or longitude) from the csv datasource to rows (or columns); this will create another map
right click on the newly added measure and select "Dual axis"; this will overlap the two maps
in the marks box on the left you will be able to select different display settings for the two axis you will then have
You can also find a nice tutorial here

Mapbox how to query for the features which are available in current view port?

I want to use mapbox's queryRenderedFeatures API which will give me the set of "visible" features satisfying the given query parameters.
Does this gives the feature set from current map viewport only? If not then how do I fetch the features from current viewport only?
Is there any way where I can provide x,y coordinate bounds of a map viewport to queryRenderedFeatures API?
Yes this gives the features from the current viewport only.
You can get a subset of those features by giving a bounding box with the geometry parameter. See the documentation for this functon.
Omitting this parameter (i.e. calling Map#queryRenderedFeatures with zero arguments, or with only a options argument) is equivalent to passing a bounding box encompassing the entire map viewport.

Why can't I add a single value to an entire column in PostgreSQL PostGIS?

I'm new to PostgreSQL, so bear with me.
I have two tables, one called "polys" with several polygons and another called "box" that contains only one polygon (my bounding box). My query selects all the polygons in "polys" that fall within the bounding box "box" - a clip if you will. Both tables have two columns, one containing their ID's and another containing their GeoJSON called "the_geom".
What I want is one column containing IDs of polygons that fall within the bounding box, another column with these polygons' GeoJSONs called "the_geom_webmercator", another called "polygonarea" with each polygon's area, and then another column called "totalarea" which contains the SAME EXACT VALUE for each polygon (the value being the sum of all the polygons). However, simply asking for the SUM won't work since this returns only 1 value. Instead, I want this value to fill the entire column. Below is what I've tried; the `SUM...AS' is the portion in question.
SELECT polys.id, ST_Transform(ST_Intersection(polys.the_geom, box.the_geom),3857)
AS the_geom_webmercator,
ST_Area(ST_Transform(ST_Intersection(polys.the_geom,box.the_geom),3857))
AS polygonarea,
SUM(ST_Area(ST_Transform(ST_Intersection(polys.the_geom,box.the_geom),3857)))
AS totalarea FROM polys,box
If you use the SUM() aggregate-function you also need a GROUP BY statement.
I guess what you want is a WINDOW Function
http://www.postgresql.org/docs/9.1/static/tutorial-window.html
With window function you can calculate aggregates for single rows without GROUP BY.
SELECT
polys.id,
ST_Transform(ST_Intersection(polys.the_geom, box.the_geom),3857) AS the_geom_webmercator,
ST_Area(ST_Transform(ST_Intersection(polys.the_geom,box.the_geom),3857)) AS polygonarea,
SUM(ST_Area(ST_Transform(ST_Intersection(polys.the_geom,box.the_geom),3857))) OVER () AS totalarea
FROM polys,box

why do getOffsetWidth() and getElement().getClientWidth() return 0 for a Widget in GWT?

I'm using RaphaelGWT to draw shapes with the underlying RaphaelJS library. Both projects are wonderful. However I was stuck for awhile on the issue of Text objects in Raphael being displayed as centered by default.
I've tried to create one Text object and let it be centered by default, then measure its width in order to adjust the position for a 2nd text object and then remove the first. But I can't get the width of the original Text object.
FYI, in RaphaelGWT, the Shape objects used extend Widget. So I've tried getAbsoluteLeft(), getElement().getAbsoluteRight(), getOffsetWidth(), getElement().getClientWidth(). getAbsoluteLeft() is the only one that returns what I would expect. getAbsoluteRight()returns the same value as getAbsoluteLeft(), and both getOffsetWidth() and getElement().getClientWidth() return 0.
Why?
FYI, I calculated the width from the original x value used to create the Text Shape (x then became the center) and getAbsoluteLeft(), which actually returned the expected value.
The element has to be visible for getOffsetWidth() to return correct values.