Hot answers tagged

56

I have seen this technique used in the past. It was explained to me by Zain Memon (from Trulia) who helped giving some input when Michal Migurski was creating TileStache. Zain went over it while explaining his Trulia demo that uses this technique at one of our older SF GeoMeetup meetings some time back. In fact, if you are in SF next week (this is my lame ...


52

As pointed out by @Greg, instead of TileStream (my first attempt) you should use Tilelive to host your own vector tiles. Tilelive isn't a server itself but a backend framework that deals with tiles in different formats from different sources. But it's based on Node.js so you can turn it into a server in a pretty straight-forward way. To read tiles from a ....


50

This is a topic that always comes up. I may not have the right answer, but I can give you my personal opinion. The reason that they are supported, can be attributed to several characteristics about them, so let me mention a few. First, there is a spec. I mean, I am in my early thirties and this thing existed since I was a teenager. So it is safe to say ...


40

Update for QGIS 3.x: The old OSM importer from QGIS 2 was dropped in QGIS 3 due to lots of unresolved bugs. The QuickOSM plugin also enables to read osm raw files. You can use user Layer - Add Layer - Add Vector Layer instead. In that case, OSM data are opened with GDAL as documented by http://gdal.org/drv_osm.html In QGIS 2.x, There are 3 steps involved ...


36

For the osmosis docs, I see the command option: --bounding-box top=49.5138 left=10.9351 bottom=49.3866 right=11.201 for PostGIS you can use ST_MakeEnvelope(left, bottom, right, top, srid) to build a bounding box, then the && bounding box operator to find where the bounding boxes intersect: SELECT * FROM mytable WHERE mytable.geom && ...


29

In GIS, vector and raster are two different ways of representing spatial data. However, the distinction between vector and raster data types is not unique to GIS: here is an example from the graphic design world which might be clearer. Raster data is made up of pixels (or cells), and each pixel has an associated value. Simplifying slightly, a digital ...


26

The hosting of the vector tiles on your own is relatively straightforward. The MBTiles contains .pbf files which must be exposed to the web. That's it. Probably easiest is to use a simple open-source server such as TileServer-PHP and put the MBTiles file to the same folder as the project files. The TileServer do all the hosting config for you (CORS, ...


25

There are several ways to do this. If you don't have Spatial Analyst you can do it anyway as follows: First, convert the raster to Points using the Raster to Point tool. This gives you a grid of points and is relatively quick - 16million points were created in about 2 minutes (be sure to turn off rendering so they aren't displayed though ;-) ). Now, use the ...


24

Yep sure can. Like alexgleith said you can use the qgsaffine plugin (from the plugin installer) The top of the first line is at 0,0 and the top of the second line is at 5,5. At the start the points are along 0 on the X. Using the Affine plugin we can add 5 to all the X coordinates: Then after they are all on the second line at X 5, Y 5:


23

Direct from the developer Dino Ravnic on a recent mailing list post: It's not a big secret how we did it so I would be happy to share that with you..the key is in two things: removing from a tile all vectors which are to small to be visible i.e. their area when calculated into pixels is less than 1px. so we drop such a vector and instead of ...


23

Unfortunately you cannot connect a web page directly to a database because of security concerns, normally you need some middleware to join the two together. So for your example and if you want to stick with Open Source software you could easily use GeoServer as your geographic server to serve your data from your PostGIS database to your OpenLayers HTML web ...


21

This is the task for the Zonal Statistics tool. Go to Spatial Analyst Tools > Zonal > Zonal Statistics and select the Mean statistic. The raster should have an attribute table for this.


21

As Gabor Farkas said, I was adding the geometry and not a feature to the source. I was also missing [] on the coordinates to the geometry, and wasn't converting properly. Outside of here, I was using lat/long as x/y instead of y/x. Updated fiddle: http://jsfiddle.net/Kieveli/f4t6n6v1/7/ HTML: <div id="map" class="map"></div> JAVASCRIPT: ...


20

The hint provided by @mdsummer of using byid=TRUE works accurately. See the reproducible example, below: library(rgeos) library(sp) #Create SpatialPlygons objects polygon1 <- readWKT("POLYGON((-190 -50, -200 -10, -110 20, -190 -50))") #polygon 1 polygon2 <- readWKT("POLYGON((-180 -20, -140 55, 10 0, -140 -60, -180 -20))") #polygon 2 par(mfrow = c(1,...


18

The SHP+SHX part itself isn't so bad. The real problem lies in the DBF part. That could do with a new format, which supported unicode and all sorts of modern field types. The problem is getting it well supported by all the software out there.


18

You're almost there. This is on Windows 7, Python 2.6.5 32bit, and GDAL 1.9.0: >>> from osgeo import ogr >>> driver = ogr.GetDriverByName("FileGDB") >>> ds = driver.Open(r"C:\temp\buildings.gdb", 0) >>> ds <osgeo.ogr.DataSource; proxy of <Swig Object of type 'OGRDataSourceShadow *' at 0x02BB7038> > >>>...


18

If you simply want to dissolve the edges and are happy with having one large multipolygon feature of all buildings, you can simply use the fTools "Dissolve" tool ("Vector/Geoprocessing/Dissolve"). If you want to keep the attributes (in the case of OS Vector that would only be the ID, which seems to be rather arbitrary), you can split the dissolved vector ...


18

The layer extents are available in the Layer Properties | Metadata section.


18

The compactness of an object can be measured using the Polsby-Popper test by determining the Polsby-Popper (PP) score. The PP score is determined by multiplying the polygon's area by 4pi and dividing by the perimeter squared. Using this, a circle will have a score of 1 and any other geometric shape has a smaller ratio. disc :(4*PI)* PI*R² / 4PI²R²= 1 ...


18

Yes, it is possible. What you need is rule-based Styling with a scale rule as shown in the image (sorry for german layout) It looks like this when you zoom in and out : keep in mind, that when you zoom out of the defined zoom levels, the layer won't be shown. EDIT: To have different styles within a category you can refine the rules by right-clicking ...


17

As I described on the OSGeo list the key is in delivering data as vector JSON tiles that have pixels for subpixel geometry and generalized geometry for those features that will be actually visible on a certain level. Performance is great because this technique eliminates all unnecessary vector information and leave only those vectors that will actually have ...


17

To remove duplicates: You can use the Delete duplicate geometries tool by accessing it via the Processing Toolbox: Another option is to use the v.clean tool from GRASS and select the rmdupl option: To remove overlaps: You can use the Dissolve tool, provided there are common attributes between the original polygon and the overlapping polygon: As always, ...


15

Are you on QGIS 1.8? If so, you can remove your vl with: QgsMapLayerRegistry.instance().removeMapLayers( [vl.id()] ) otherwise: QgsMapLayerRegistry.instance().removeMapLayer( vl.id() ) And if you are on QGIS 3.0+, replace QgsMapLayerRegistry with QgsProject. Or if by chance you want to remove all empty layers, check out the Remove Empty Layers plugin.


15

In ArcGIS you can use Hawth's Tools to generate your points or in QGIS you can use Vector->Research Tools->Random Points or Regular Points. However, you say the points will represent windmill bases and you want to maximise production. So, personally, I would not use either of these methods. Maximising windfarm production is dependent on much more than ...


15

I found downloading OSM data using the plugin and going through the import and export motions very tedious. That's why I wrote up a different solution: http://anitagraser.com/2014/05/31/a-guide-to-googlemaps-like-maps-with-osm-in-qgis/ Summary: Raw OSM files can be quite huge. That’s why it’s definitely preferable to download the compressed binary .pbf ...


15

Interesting question! I'm not aware of any other way of achieving what you want, but using PyQGIS. Read the code below. It has some texts in it: 'lines', 'length', 'startX', 'startY', 'endX', 'endY'. You can adjust those names in the script for it to work on your data. The first one is you layer name, whereas the rest corresponds to field names. I assume ...


14

Looks like a very similar question was recently asked on the OSGeo Open Layers forum, with the GIS Cloud developers describing their approach, which is a interesting mix of GeoJSON geometries and static pixels. They actually generate all vector tiles on the fly instead of using a pre-built cache of GeoJSON files. Esri has implemented a similar approach, ...


14

Convert Vector to Raster wraps GDAL's gdal_rasterize, which until version 1.8.0, didn't create the output raster. So the cell size, projection, and so on are determined by the raster not the command line options. It is something of a Catch-22 for sure because GDAL has no easy method of creating an empty image. You can try creating two one-pixel images for ...


14

The easiest way to do this is to create a polygon that covers the extent of your area of interest and turn on "avoid intersections" when drawing it. So initially I have some polygons: I then turn on snapping: go to Settings > Snapping Options... and for Layer selection dropdown choose Advanced. You must have this set up correctly. I usually recommend a ...


14

I'm guessing you created a shapefile layer. You have to choose a good "file encoding" already at creation time, in the same dialog. Using QGIS 2.18, I created a new layer and chose the UTF-8 encoding (ISO 8859-8 or Windows-1255 should be fine too). Then I added a text field to it and copy/pasted some Hebrew into them from the internet. Editing the layer ...


Only top voted, non community-wiki answers of a minimum length are eligible