AnsweredAssumed Answered

How to size a graphic properly

Question asked by cristb1971 on May 21, 2020
Latest reply on Jun 1, 2020 by cristb1971

Sorry to ask this question which I think demonstrates my ignorance to all things GIS.  I am integrating ArcGIS runtime for QT with an existing user interface which until now has had a home-grown mapping system.

What I want to do sounds so easy; yet I am hopelessly lost trying to understand graphic scaling; especially as it pertains to spatial references, the Geometry Engine and reference scales.

 

I'm using the Runtime API version 100.8 and QT 5.14 on an Ubuntu system.

 

 

The simple-seeming question:

I have a square that is 100 meters x 100 meters.  This square is at a known location.  I want to draw it such that it is actually represented as 100 meters x 100 meters onscreen.

 

The map is a Topographic Vector.  The mapView is a MapGraphicsView.

I set a reference scale to a positive number on the map.  More on this below.

I added a GraphicsOverlay named overlay with scaleSymbols set to true.

My graphic, a QImage named origGraphic, which represents a 100mx100m square, is 100pix x 100pix.

 

Using this methodology (after ensuring mapView units are LinearUnit with a type of meters):

width = origGraphic.width() / mapView->unitsPerDIP();
height = origGraphic.height() / mapView->unitsPerDip();
QImage newGraphic = origGraphic.scaled(width, height);

PictureMarkerSymbol img = new PictureMarkerSymbol(newGraphic);
Point point(location.x, location.y, SpatialReference::wgs_84());
overlay->graphics()->append(new Graphic(point, img, this);

 

After running this, I am left with the following, at the map reference scales shown:

1:1  - a square whose sides are 0.073 meters long

1:1000 - A square whose sides are 73.213 meters long.

 

So I can see a relationship there; but I don't understand it.  I can add that the map's Viewpoint scale is set to 1000 in both cases.  The mapView->unitsPerDip is .264583 at the zoom level of the viewpoint.

 

I guess what I really am asking is for an explanation of how I can put something that I know is 100 meters x 100 meters on a map, such that it is represented at that "size" on the map.  If anyone can point me towards a guide, or a relevant section of the API I would be forever in your debt!

 

Sorry again for the ignorance behind this question.  I hate to waste your time.

Outcomes