I have a shapefile of multiple polygon features corresponding to geographic regions that vary in area. The task is to create a dynamic grid over each polygon, with the size of the squares for each grid dependent on the area of the polygon, e.g. if area of polygon exceeds a certain threshold then grid square width and height is x metres by x metres. I can use the Grid Index Features tool in ArcMap (v 10.7) to create one grid over a single polygon, so am wondering if this can be extended to loop through multiple polygons, producing the required grid for each polygon. The ultimate aim is to create input for Data Driven Pages to produce a map atlas for each geographic region, including an overview map plus maps for each of the individual grid squares to provide greater detail.
Related
I have polygons features on a Mapbox map. Their sizes vary a lot (some are big as streets, others are as little as a tree).
Each polygon has an a point feature on it (a circle) that acts as an handle to open a popup related to the polygon data.
But depending on the zoom level, the circle/point is sometimes bigger than the polygon itself; since the polygon "sticks" to the map while the circle size remains unchanged.
What I would like to achieve is to hide the polygon (and its handle) if the polygon size in pixels is smaller than the circle :
when zoom changes
get the size in pixels of a bouding box containing the polygon
compare it to the size of the circle
hide both of them if circle radius > polygon smaller side.
I think I'm capable of coding this, but then... how can I hide the features ?
There is a minzoom / maxzoom setting for sources and layers, but how can I achieve this per-feature ?
Thanks!
Within the Style Specification, there's no way to access a feature's size. https://docs.mapbox.com/mapbox-gl-js/style-spec/
How many features do you have on your map? Is it possible to precompute the size of the feature and use that to style when it's visible?
in the particle filter algorithm, particles should present as a dots or it can be represented as rectangle boxes? in the case of rectangle boxes, how I can determine the box size? if the object is far from the camera I want to show an object with a small box (particle), but when it is near the camera with a bog rectangle box (particle)
A particle is an element of the search space. If the search space is defined as the set of all possible positions (as in classical partical filters used for localization problems in mobile robotic) a particle is a position in this search space, aka a dot.
If you define the search space as set of all possible rectangles, a particle would represent a rectangle and therefore can be represented as one.
Thus, it sorely depends on the implementation of the particle filter.
VB2010 I am using the DataVisualization.Charting.Chart control and am using it as a very crude map of several geographic points. I have that working and it looks good but am trying to see about adding an image to the chart so that it would simulate the land masses. The problem I see is that I zoom around the chart programmatically, so not sure how i can anchor the image to certain x,y coordinates. I don't want to go the whole GIS component as those types of controls are just too much for this fairly simple app.
Update: Well I sort of resolved it. I generated a full world map based on the WGS84 (some would call geographic) projection. This splits the world into perfect 20d x 20d squares. I added this graphic to the BackImage property of my main Chart. I add my points but force the extents of the graph to x: -180 to 180 and y: -90 to 90. Its crude but its actually spot on for my purposes. The only thing that i cant do is zoom in to my points of interest as the background image is static. I wish there was a way to zoom the background image to anchor parts of the image to coordinates on the graph.
I'm working in Objective-C, and storing my vertices points in an NSArray.
I have an array of 2D vertices with their bounding box, which I call "polygon".
I would like to distort the whole polygon according to how I move the corners points of the bounding box.
I guess I'll have to calculate some proportions depending on which corner I'm dragging. But, I don't know from where to begin for the calculations, and if there's a simple and fast algorithm for this. I don't want to use an external library, adn perform the calculations directly in my program.
The image here is produced by using an image software "distort" function, that does exactly what I want. If it is possible on a bitmap image, I suppose it is possible on any matrix of points.
I'm using a 3d engine and need to translate between 3d world space and 2d screen space using perspective projection, so I can place 2d text labels on items in 3d space.
I've seen a few posts of various answers to this problem but they seem to use components I don't have.
I have a Camera object, and can only set it's current position and lookat position, it cannot roll. The camera is moving along a path and certain target object may appear in it's view then disappear.
I have only the following values
lookat position
position
vertical FOV
Z far
Z near
and obviously the position of the target object.
Can anyone please give me an algorithm that will do this using just these components?
Many thanks.
all graphics engines use matrices to transform between different coordinats systems. Indeed OpenGL and DirectX uses them, because they are the standard way.
Cameras usually construct the matrices using the parameters you have:
view matrix (transform the world to position in a way you look at it from the camera position), it uses lookat position and camera position (also the up vector which usually is 0,1,0)
projection matrix (transforms from 3D coordinates to 2D Coordinates), it uses the fov, near, far and aspect.
You could find information of how to construct the matrices in internet searching for the opengl functions that create them:
gluLookat creates a viewmatrix
gluPerspective: creates the projection matrix
But I cant imagine an engine that doesnt allow you to get these matrices, because I can ensure you they are somewhere, the engine is using it.
Once you have those matrices, you multiply them, to get the viewprojeciton matrix. This matrix transform from World coordinates to Screen Coordinates. So just multiply the matrix with the position you want to know (in vector 4 format, being the 4ยบ component 1.0).
But wait, the result will be in homogeneous coordinates, you need to divide X,Y,Z of the resulting vector by W, and then you have the position in Normalized screen coordinates (0 means the center, 1 means right, -1 means left, etc).
From here it is easy to transform multiplying by width and height.
I have some slides explaining all this here: https://docs.google.com/presentation/d/13crrSCPonJcxAjGaS5HJOat3MpE0lmEtqxeVr4tVLDs/present?slide=id.i0
Good luck :)
P.S: when you work with 3D it is really important to understand the three matrices (model, view and projection), otherwise you will stumble every time.
so I can place 2d text labels on items
in 3d space
Have you looked up "billboard" techniques? Sometimes just knowing the right term to search under is all you need. This refers to polygons (typically rectangles) that always face the camera, regardless of camera position or orientation.