Getting coordinates from random points in polygon and sync it with shapefile in QGIS - shapefile

In QGIS, I have a shapefile that contains a polygon of administrative boundaries in a country. I need to add six random points inside the polygon.
Can i get the coordinates from random points feature and sync it with my polygons?
Ex: I have US administrative boundaries shapefile that contains "country_name" and "state_name". Then, i generate six random points for every states. Afterward, i want an exported .xlsx file which contains "country_name", "state_name", "lat_long_1", "lat_long_2", "lat_long_3", "lat_long_4", "lat_long_5" ,"lat_long_6" which every "lat_long" is accordance with its state.
What should i do?

You can use 'Random Points Inside Polygons' functions under Vector/Research Tools.
After that with created points, you can use 'Connect Attributes by Location' functions under Vector/Data Management Tools.

Related

Attach markers to a bezier line and then "Pull" it straight with Inkscape

I have a bezier curve that I've used to trace the curve of a stream on a map. At points along the stream I have objects that mark the location of data. Is there anyway to attach the objects to the stream-curve and then straighten the curve?
I'd like to have this in order to create a river profile and also measure the distance between different pieces of data (some markers are elevation, and some are other data).
Before:
After:
... In my image, all of the markers should be evenly placed along the line, they just aren't perfectly placed in the version I made by hand.

how to query the database to return all zip codes with a given distance (ie 5 miles) from a given zip code using geopy

Hi frens I am using geopy to calculate the latitude and longitude. Now I want to get the list of areas given distance from a zipcode.How to get that?
Well, as I can see, geopy doesn't have any built-in capability to get a list of areas around some coordinates.
But you can use a workaround. Take your geocode and calculate coordinates (latitue and longitude). Then imagine a grid on the map with a cell size equal to area of the smallest one you need to find around your location.
Use geopy to get an area name belonging to the each cell corner of your grid. Is that ok for you? It will get you some kind of approximation because a grid is not a circle and you may miss some small areas. But I think in most cases the solution will work fine.
It is much easier to locate zipcodes inside a rectangle than in a circle so I would recommend that you approximate your problem by looking for zipcodes inside a given rectangle.
Here are answers to the question of how to get list of zipcodes in given polygone: Find zipcodes inside polygon shape using google maps api
Summary
You need geometry for each zipcode. Once you have that you need to be able to query it using database that supports geoquery. One such database is Google's Fusion Table and there is already a geometry data table for zipcodes available here: https://www.google.com/fusiontables/DataSource?docid=1AxB511DayCdtmyBuYOIPHIe_WM9iG87Q3jKh6EQ#rows:id=1
Here's the sample query for Fusion Table data.
Another approach is server side code using PHP and CSV data. Here's live demo: http://daim.snm.ku.dk/demo/zip/. The page also has download for code.
If you use any of above technique please make sure to upvote answers of original authors :).

Turn on boundary layer if more than one record in the map extent/ layout view?

Anyone have any ideas as to how can I automate the process where if there is more than one administrative boundary area in the map extent to turn on that boundary layer for map labeling using a python script from within a map document?
For instance, if there are multiple county boundaries within the visible map extent (say the area of interest overlaps two counties) to turn on the boundary layer? I do not want to tabulate intersection on the area of interest as it does not cover the entire layout. In effect, if only one county is displayed in the map extent/layout, do not turn on the county layer. However, if it does display more than one county, turn on the county layer for display in the map extent/layout. I am trying to automate map production and am stuck on this one as I am “tabulating the intersection” of the map/layout extent, not a specific feature class.
Make sense? Thanks for any and all guidance as to how to approach this.
Using ArcGIS 10.1 SP1 Advanced
If discovered a way yo do this. I snagged an script that creates a polygon from the current map extent. I then performed a tabulate intersection on the boundary using this polygon. If the length of the resulting table was larger than 1, I turned the layer on.
Create polygon from map extent script link

c++ Determine images in a polygon contour

I am using GPC (General Polygon Clipper) to create sets of images. I am unable to determine if the images are from disjoint sets though.
I am using a gpc_polygon struct defined at the above link, reading the vertex list from an image data (lat/lon of corners)... And adding images sequentially to a polygon.
It is important to separate images that belong to separate regions. While I can't say for sure that the intersection area will be non-zero (that would have been a perfect test), I have noticed that the num_contours of the completed polygon coincides with the number of distinct regions.
I thought that I can use num_contours to determine if an image belongs to a set.
Yet, as I add images, I can see, on one image, num_contours=1, after the second, it increases to 2 (whether the image is in the same section or not, and that makes sense)... but it doesn't increase after that, until the pattern of disjointed images is really off - so I can't really use it to test, at least not on its own.
It is the same as I remove images from the polygon, using a DIFF operator.
If anyone else has used GPC, or some other method of polygon convolution, perhaps you can give me some advice on what I can use to identify which images belong to each contour, so I can either separate them before, or after, polygon creation ?
I used num_contours, with a limiting value of 2 instead of 1, and had to go back iteratively, and try to re-add contours, until I couldn't add them anymore. The solution is suboptimal, may be very slow, and there are situations when polygons that don't belong together end up in the same contour.

vtkImageData blank cells or blank points using VTK

Is it possible to assign certain cells / points of the vtkImageData to be blank? The point is that cca. 90 % of my vtk domain is empty. The vtk files are huge just because they contain a lot of nothing.
Have you considered using another data structure besides vtkImageData? For sparse points, you could use vtkPolyData.