Tag Info

New answers tagged

3

I would use either the Con or Reclassify tools to create a new raster with the value range that you are interested in and then perform the raster-to-vector conversion on this newly created raster. Two steps and you're done!


3

In the OGC specification, which can be downloaded here they state: "Polygon rotation is not defined by this standard; actual polygon rotation may be in a clockwise or counter-clockwise direction." In SQL Server Spatial, the geography datatype follows a counter clockwise rule for the outer-ring, and clockwise for the inner rings -- see this MicroSoft ...


3

I don't know that anybody will be able to provide a definitive answer for your question since each vector file format is different and each GIS, in terms of how they internally handle these data, will also be different. But I can tell you for certain that the clockwise ordering is not only for ESRI Shapefiles. There are other formats that use a similar ...


2

Given a starting point, bearings and distances the Azimuth and Distance plug-in will do this too.


1

The plugin Cadinput might be what you are looking for (https://plugins.qgis.org/plugins/CadInput/). See http://vimeo.com/85052231 for a demonstration.


-1

Can you use Spatial Join to stamp the IDs into the polygons?


0

You may have multi-part polygons in your file, and the area column would thus be reflecting the total area of all 'parts' of a polygon. You can use the Vector > Geometry Tools > Multiparts to singleparts tool to create single-part polygons, and calculate the $area on those to get the answer you are expecting.


2

@DarrenCope made a very good point, your layer contained inconsistencies. Please note: I only posted this as an answer as to include a screenshot of the results, please accept Darren's answer when he posts one as he came up with the correct solution. I used the Multiparts to singleparts function (via Vector > Geometry Tools > Multiparts to singleparts) ...


0

You could create a grid of small squares that cover the world. Then a script could loop on every adjacent square and while(sum(squares.population) < 1000000) {merge(squares)}. For the last square that would make you jump above 1 million, you could do the same with much smaller squares. You should roams across the squares like a snake, not in line, so the ...


1

OpenLayers has a GetCentroid function for getting the centre of a polygon if you don't want to bring it in from the database directly: http://dev.openlayers.org/apidocs/files/OpenLayers/Geometry-js.html#OpenLayers.Geometry.getCentroid From there you should just be able to treat the point as a regular point feature. See also this example: ...


1

I've used the Natural Earth shape files - they are great and cover all countries down to an incredible level of detail (railroads!): http://www.naturalearthdata.com Laurent Dupuis has shared his amazing project which shreds ALL of the natural earth data (including all the dbf attributes) straight from the zip file you download, into SQL tables (that his ...


1

You could do this using Javascript Topology Suite which will work with Node.js. Start with an empty MultiPolygon (or the first geometry in your collection) and union this with each (Multi)Polygon in your collection. You can only have one format for the whole collection, obviously, as properties are one to one with the geometry in the GeoJSON. Here are some ...


1

I finally found also an R-solution for my problem. The rgeos package offers the get.pts function which allows to extract the number of vertices. As we have learned from the first comments, the number of edges is equal to the number of vertices - 1. Programming a solution for my task in R seems now much easier.


2

I've updated the original code given here http://stackoverflow.com/questions/26087772/create-polygon-from-set-of-points-distributed/26089377#26089377 Instead of Bezier-based smoothing, you can used the smoothing suggested here http://gis.stackexchange.com/a/24929/8104 with the function spline.poly (as suggested by @aaron) which gives accurate results.


5

You can use Mapshaper for this, and then dissolve from the command line: mapshaper --dissolve -i your_data.geojson


2

It's easy to do with QGis. Open QGis Drag&Drop the geojson file to qgis use the "dissolve" tool in the vector menu (it's inside a submenu). use the "dissolve all" option from the dropdown this will create a shapefile (check the box to output to the map) which you can then again save as a geojson file by right-clicking it in the layer pane and choosing ...


0

you could draw rectangles with points in the line drawn acting as a center for each rectangle something like what has been asked here


1

I had a similar problem and used a kml parser (geoxml3) to locally parse a kml. I later ended up storing each kml file as a database table and looping through the records to plot a polygon. Loading the kml from a server was the slowest of all.


1

You could use a spatial database (like PostGIS). First, you put all your addresses in a table "addresses" with a column "Point" of type Point and a column "Address". CREATE TABLE addresses (Point Point, Address Varchar(50)); Then you put your polygon in another table, let's call it "poly". It can have a column "Polygon" of type Polygon and another column ...


1

There are a couple of options. Option 1 You could do the query exactly like you have it, then add your linestring using GeoJSON on the client. You'd use CartoDB.js to draw you polygon layer and then use Leaflet to add the GeoJSON layer on top. Option 2 Use a multilayer visualization. The bottom layer you could have as you polygons (styled accordingly. ...


5

With Python and Fiona, Polygons and MutiPolygons (multi-parts) are different geometries: 1) multi-parts geometries import fiona shape = fiona.open("polygons.shp") # shapefile schema print c.schema {'geometry': 'Polygon', 'properties': OrderedDict([(u'id', 'int:10')])} # first feature first = shape.next() print first (GeoJSON format) {'geometry': ...


5

In QGIS if your polygons do not have any holes or multi-parts: l = iface.activeLayer() for f in l.getFeatures(): print f['NAME'] print 'no. edges: %d' %(len(f.geometry().asPolygon()[0])-1) replace 'NAME' with some identifier in your layer attribute table. Concerning writing to the attribute table check the instructions in the PyQGIS Cookbook - ...


3

The problem is that col.regions expects a vector with values or names for colors and you are giving it factors. When you build your dataframe your string vectors are (by default) turned into factors and the levels of the factors are (by default) ordered, in this case alphabetically. This is the reason why the mapping of the colors to the categories is off. ...


0

The Microsoft Developer Network help docs seem promising. Here is an example from the help on to test for intersection: DECLARE @geom1 geometry; DECLARE @geom2 geometry; DECLARE @result geometry; SELECT @geom1 = GeomCol1 FROM SpatialTable WHERE id = 1; SELECT @geom2 = GeomCol1 FROM SpatialTable WHERE id = 2; SELECT @result = @geom1.STIntersection(@geom2); ...


2

In R, you can used the sp package and over function to do this. I adapted an example data set and the solution from this post by Roger Bivand. library(sp) library(rgeos) library(rworldmap) box <- readWKT("POLYGON((-180 90, 180 90, 180 -90, -180 -90, -180 90))") proj4string(box) <- CRS("+proj=cea +datum=WGS84") set.seed(1) pts <- spsample(box, ...


2

You can create square and rectangular grids using the Vector Grid tool under Vector > Research Tools > Vector Grid. To get the required coordinates, I suggest using the Coordinate Capture tool and then input the Xmin, Xmax, Ymin, Ymax from these captured points. Note that the units will be in the coordinate system currently used, so you might want to ...


0

A workaround would be to re-add the attributes after doing the clip, while converting from SpatialPolygons to SpatialPolygonsDataFrame. clip = gDifference(spdf1,spdf2, byid=TRUE) row.names(clip) = c("p1","p2") spdf3 <-SpatialPolygonsDataFrame(clip,data=as.data.frame(spdf1@data)) spdf3@data variable1 variable2 p1 232 235 p2 242 ...


0

Use ST_DumpPoints to get a set of vertices for each polygon in 3. From that construct Voronoi Polygons around your vertices Dissolve the Voronois by grouping Clip the resulting shapes with your department boundary.


0

There does not seem to be any limitations measuring across the antimeridian with this library: library(geosphere) # small distance across the antimeridian distVincentyEllipsoid(c(-179.999, 0), c(179.999, 0)) # 222.639 # this should be zero, but tiny errors have entered in the maths distVincentyEllipsoid(c(-180, 0), c(180, 0)) # 1.556904e-09 And if you ...


5

Here is a method using arcpy geometry objects. The script creates a rotated hull rectangle around each polygon, splits it into plots, and clips the plots to the original polygon. As Aaron mentions, you could likely achieve this with the fishnet tool, but I could not figure out how to (in Step #2) "use logic to find the ordinal coords" for rotated polygons. ...


3

You will want to create a ToolControl button that allows you to click on a map as opposed to a button which does something when you click on it. Then grab the point, create a spatialfilter and query your polygon layer, this returns a Feature object which you can return the various address components and populate some form that you created. The bold words ...


1

Okay, let's rock these features out of the DragBox! There are three options I have found to extract those features from the extent of the DragBox. Considerations and assumptions: I couldn't extract the layer types (raster or vector) from the map.getLayers() object, so let's assume that we stored the feature layers in individual global variables. The ...


0

For some project i had the same need. Much more than keeping the data.frame, we had to put in place further code to manage output geometry type, and proceed to some cleaning (e.g. clean geometry collections), to have some complete intersection geoprocess. In case you still need to do such a task in R, you can try the RFigisGeo package: #install RFigisGeo ...


2

A wiki article Centroid describes a few methods, including this one, which is probably the one used by most GIS tools: Centroid of polygon The centroid of a non-self-intersecting closed polygon, defined by n vertices (x0,y0), (x1,y1), ..., (xn−1,yn−1), is the point (Cx, Cy), where and where A is the polygon's signed area, ...


4

You could automate this approach with Python using the Create Fishnet (Data Management) tool. You can extract all of the pieces of the puzzle to do this analysis with python and then simply plug the pieces into the fishnet function. You need to start by iterating over all of the section polygons. Otherwise, you will get one large fishnet covering the ...


1

I've analysed the geometry issues in the attached data, and it seems it does not ONLY have orphaned holes but also geometry validity issues. It's true that an orphaned hole is somehow a geometry validity issue, but rgeos does not handle it in the same way, as for orphaned holes, an error is raised, instead of a simple warning. As you indicate, they are hints ...


3

Nope, you're pretty much bang on! You have to create a folder called "svg" in your ".qgis2" directory. You should be able to find this in: C:\Users\(your user name)\.qgis2 Then create the new svg folder, insert your flags in there and you should be able to see them in your Style > Symbol interface: For me, QGIS did tend to run a bit slow so it may be a ...


4

In InkScape, try saving the image as "Plain SVG" if you're not already doing so. Also try positioning the center of the flag in the upper left corner of the canvas (this is origo of an SVG.)


0

I went the model builder route. This seemed to work. The input shapefile is A I then iterated through Features while setting the %Value% As the attribute. Then used FC to FC tool with the output name as %Value%.shp Phoelm ArcPy (alternate comment and answer) worked on 90% of the files but see the comment for a strange error on a few of them.


2

# import libraries import arcpy, os # path to file polyFC = r'C:\junk\raa\RAA_20140522.shp' # field name to use for file names fieldName = "FID" # set overwrite environment arcpy.env.overwriteOutput = True # loop through features for row in arcpy.da.SearchCursor(polyFC, ["SHAPE@", fieldName]): # make new filename based on field value newName = ...


1

I would suggest using arcpy. Here is the general proposed code flow: Make feature layer of layer of interest Use search cursor on feature layer to get attribute of ID field and attribute of field for new shp name Use select by attribute method for each ID attribute for each row (i.e. unique feature) Create new feature class on selected feature layer using ...


1

Not sure if I understand your question correctly, I will delete this post if I am mistaken. Go to your Attribute Table, select Show All Features and then Advanced Filter (Expression): In the expression box, enter: xat(i) AND yat(j) and replace i and j with your coordinates. You should see the data associated with those coordinates.



Top 50 recent answers are included