Tag Info

New answers tagged

0

Information on creating Projections is available here from the Esri Site. See the part on Manual Creation down the page. There is an excellent discussion on ShapeFile Projections and PostGis here and an example of the SQL to insert the Custom Projection into PostGis can be seen here The SQL to insert the Custom Projection is probably of the most interest ...


3

You can use ST_DumpPoints to get the points and then ST_AsLatLonText to get nicely readable coordinate output. It doesn't care if the geometries are multi* or not. Alternatively, you could use ST_Boundary to get the polygon vertices, but you'd need to use ST_Dump first for this to work for multipolygons too.


6

First, install the psycopg2 package, a Pythonic interface for PostgreSQL. Then, use ST_MakePoint: >>> import psycopg2 >>> conn = psycopg2.connect(dbname=..., port=..., user=..., password=..., host=...) >>> x, y, z, = 32, 34, 0 >>> cur.execute("SELECT ST_SetSRID(ST_MakePoint(%s, %s, ...


0

Hmmm... no answers here ... Ok... look for this line inside the config and comment it out: postp.1.class = de.cm.osm2po.plugins.PgVertexWriter This will give you an additional table of vertices. Look for the ref_count-column. A value of "0" indicates dead ends or "no crossing". But what are you going to interpret in your example above if it's composed of ...


0

The default config reflects a standard car-routing-topo. Hence it should not take footways or sth. similar into account. finalMask=car means that only ways which are drivable will be included and converted. But be careful. Paths or tracks and even ferries may be tagged with motorcar=yes. This indicates an alternative potential type of transport for cars ...


1

1) You seem to have a mix of projections in your original files (shapes) so, How are you loading the files to Postgis? Specifically, What projection are you passing as a parameter to shp2pgsql? because if I remember correctly, if you don't specify a srid then Postgis assumes it to be in local coordinates (srid 0) and planar units so that maybe why you're ...


1

This isn't covered by the functionality of most webmap toolkits. Instead this is realized by the renderers who create the basemap that is embedded with Leaflet. Thus, you need to setup Mapnik, Maperitive, Mapbox, ... create a mapstyle that you want and deliver it to your endusers. Otherwise you might want to adapt existing style e.g. delivered by Cloudmade, ...


2

The only way I could get POSTGis on "Trusty" was to build from Sources, here is what I used .. sudo mkdir postgis-build cd postgis-build ------------------------------------------------------ then put the script below in a shell script file sudo nano build.sh make it executable and run it sudo chmod a+x build.sh ...


2

You probably should just create a new column and I would suggest if you are new to PostGIS, you probably want to use geography instead of geometry. So somethng like ALTER TABLE m_copy ADD COLUMN geog geography(POINT,4326); UPDATE m_copy SET geog = ST_SetSRID(ST_Point(longitude,latitude),4326)::geography; If you decide to use geometry, just replace the ...


1

This doesn't answer your question directly - Mapperz has probably pointed you in the right direction. But I recommend using the UbuntuGIS package(s) as they've proven to be e-a-s-y to install and all the dependencies are there. # UbuntuGIS package: sudo apt-add-repository ppa:ubuntugis/ppa sudo apt-get update #or for bleeding edge: sudo ...


-1

You can use Spatial Manager Desktop to import OSM data into PostGIS. Please, watch this post: http://www.spatialmanager.com/import-directly-postgis-databases/ There is a limited trial version ,you can download it here: http://www.spatialmanager.com/downloads/ If you need help on this feel free to tell me. Disclaimer: I work for Opencartis (Spatial Manager ...


3

You can use ogr2ogr with the -sql option to use a sql statement


0

I cracked this in the end but it is not idea. I removed the ST_Colorband call and now the rasters merge as they should using the colorband of the RASTER raster:- raster_geom AS ( SELECT ST_AsRaster(ST_Buffer(wkb_geometry,5), --SCHEDULE GEOMETRY rast, --reference raster ...


1

First, use https://mapzen.com/metro-extracts/ for more up to date data. Second, you seem to be loading a raw osm file, and not a shapefile. Please try the same with "osm2pgsql shp" or "imposm shp" file for your region.


0

I would start with TileMill, some excellent open source software. This will allow you to design maps, pulling data from shape files, postgis, etc, and render then via Mapnik to various different formats. TillMill is used by the OSM project for rendering their tiles. TillMill has a form of CSS for designing maps, called CartoCSS, and this is used to ...


1

Depending on how confident you are with technical setups, rather than running local GeoServers, you could use something like TileMill to generate MBTiles files of all your images, or just the images using Invar. This can then be show by simple python code like TileStache. This would be a much lighter weight setup.


0

I agree with the other comments, for it to be this slow you need to not have setup indexing correctly. How are you storing the data ? Are you using JSON ? You need to have spatial columns or indexes to get fast queries working. Check out the links below for examples of spatially indexing JSON twitter data. ...


0

use "explain" (http://www.postgresql.org/docs/9.3/static/sql-explain.html) to see if your spatial index is being used, and make sure you've run "analyze" (http://www.postgresql.org/docs/9.3/static/sql-analyze.html) to make sure that the db has collected sufficient statistics on your indices. It sounds to me like you don't know what you're doing with respect ...


2

You've switched the order of your lat,lon. See the documentation for ST_MakePoint() and you'll see that it requires: ST_SetSRID(ST_MakePoint(lon, lat),4326) Then, after to make your changes, try verifying: SELECT ST_AsText(location) FROM *tablename* LIMIT 10;


0

Given the nature of the lines you're trying to create versus the geometry you have, I think it will probably be fastest/simpler to just create new features as in the tutorial you have linked to. Any method that actually converts the polygons to lines will involve splitting the lines at certain points and/or deleting a lot of extra nodes/lines/etc. There is ...


0

Use the polygon to lines tool and then remove those parts of the line layer which you don't want to keep.


1

AFAIK there is currently no 'best practise' on how you organize the OSM data at your PostGIS backend. There are different database schemas that are tuned for specific purposes: rendering geospatial lookups / reverse geocoding fulltext search / gazetter ... If you have a very specific usecase, you might tweak the OSM importer mappings (e.g. at osmosis or ...


9

It is not a string format. It is a binary format using integers, double precission and special bytes used for flags. What you see as output above is not the internal format but the wkb format represented as hex numbers The internal format is described here: http://trac.osgeo.org/postgis/browser/trunk/liblwgeom/g_serialized.txt The document is written ...


3

First use st_closestpoint. Then from the result make a vertical line that passes the multilinestring. Finally use st_3dclosestpoint between the vertical line and the multiline. Theoretically you could use st_3dintersects instead but that will cause you problems from precision issues.


1

You specify that the route should start on node 1 but there is no node 1 in the query result set. That can't work ... According to the documentation http://docs.pgrouting.org/dev/src/tsp/doc/index.html, you should specify the start point id. This works: create table tsp_test (id integer, x double precision, y double precision); insert into tsp_test ...


2

For the satellite tiles, you could render them yourself using Mapnik. Landsat and NAIP are two sources of free satellite raster data. edit: I've also just come across a growing dataset (also free) of High Resolution Orthoimagery, which I've never used, but is much higher detail than the other two sources.


1

They are called diff updates. You have two options .. Apply the Diffs from PlanetOSM and then remove the imported geometry that are outside of your bounding box Use the Geofabrik Extracts for North America and apply the Geofabrik diffs which are updated daily. I do both, 3 minute diff updates for the planet and daily diff updates for the Philippines, in ...


2

Your approach looks ok to me. On my local system, I skipped the TileCache part. Mapnik fills the folders in the way Openlayers reads them from disk using file:///... I don't know if leaflet can do it the same way. For the satellite tiles: You have no chance to get them legally. Google and bing do not like storing their tiles locally. If you have ...


1

In general: ALTER TABLE your_table ADD COLUMN area double precision; UPDATE your_table SET area=ST_AREA(geom::geography); (If your srid is 4326 and your data is stored as geometry) Edit: To round to 2 decimals use round() funcrion. If I remember right it works on numeric type and not double precision. So you need something like: ...


0

The term for what you want to do is incremental updating so I recommend that you look at the Osm2pgsql page where it says: osm2pgsql has two main modes of running - normal and slim mode. It is highly recommended to run osm2pgsql in slim mode. Some important features (including incremental updates (planet diffs, the initial load to populate the ...


2

JJD yes there is. I haven't used it myself. You use the -m option and pass a mapping file that has the old column name and new column name on each line. As Ryan alluded to here: http://www.bostongis.com/pgsql2shp_shp2pgsql_quickguide.bqg I suspect he was thinking of -m and mistyped -f. Hope that helps, Regina


0

I seemed to have solved the problem by taking this approach: 1) perform create table highwaysinglegeom as select st_union(the_geom) from analysis.po_highway 2) perform the update query above using the single geometry highway table as the intersection layer rather than separate multilinestrings from my network.


1

Have you tried ST_Line_Interpolate_Point? Normally it should returns a point interpolated along a line according to the fraction of total length of linestring. The example below shows how it works. You probably need to compute the linestring length before to get the fraction of total length. --Return point 20% along 2d line SELECT ...


-1

DXF export only the rows and then copy and paste the features as a new vector layer


1

You could use the Distance to nearest hub algorithm from the Processing plugin which you could add your points and your lines layer instead of going through a query. From a couple of example layers that I have, you can get something like this: Then when you open up the Attributes Table for the output layer, you will be given the HubName and HubDist in ...


0

Looks like you need something like Osmosis or imposm. These are tools that will convert raw OSM data output by JOSM into a custom postgis format. Because OSM is free-tagging, there is no "official" way to convert the XML into a usable data structure that a GIS can read. The main importers currently focus on roads, buildings, points of interest etc. because ...


0

I defined the srid wrong. Transposed the 8 in 3857 for the 5. I used the statement below to fix!!!! Forest for the trees! SELECT UpdateGeometrySRID('roads','geom',3857);


0

Because i still can't comment here, i add this answer SCW give the best answer, select ST_AsText(ST_OffsetCurve( ST_GeomFromText('LINESTRING(10 10,10 20, 20 20 )'), 1, 'right', 'join=mitre mitre_limit=5.0')); -------------- LINESTRING(20 19,11 19,11 10) But looks like the function change http://postgis.refractions.net/docs/ST_OffsetCurve.html Now the ...


2

Well, before you convert the database, you could run the Domain to Table geoprocessing tool http://resources.arcgis.com/en/help/main/10.1/index.html#/Domain_To_Table/001700000022000000/ which should convert a domain to a stand-alone table that you could put in the database. Then, you should be able to just convert the database, including stand-alone tables ...


0

It's a bit high time I answered, but here goes: Since the use of Wax is deprecated as you mentioned, here are some Mapbox examples to get you started. Bear in mind that the Leaflet API is embedded into Mapbox.js and can be used hand in hand with Mapbox code. Using http://localhost:8000/{z}/{x}/{y}.png means to store the tiles in your own folder. This is ...


1

Probably after your requirements get complicated, it is best to think of making a scalable application. The advantage of working with a geometric column is the index, plus you can also work with wkt, GeoJSON and other standards that openlayers postgis and handle very well, so you would simplify the development Here you can find a good tutorial


1

If you have the appropriate licence (ArcGIS Advanced), using the Generate Near Table would work fine for what you are looking for. It is fairly simple to use following the instructions on the ArcGIS Resource page. However, it appears as though you may not be too familiar with GIS software, so you may wish to simplify your output by adding the city layer ...


1

Regina's comment actually answered the question--it isn't expected behaviour. As a workaround, I wrapped the call with function w/ exception block so that I get null back (which is OK for my purposes). Feel free to edit/improve because pl/pgsql isn't my strength: --DROP FUNCTION public.st_nullableconcavehull(geometry, double precision, boolean); ...


1

This probably won't work in practice, but it does in theory: ST_DumpRings to get all the linework from your polygons ST_Union the rings to get a single set of boundaries ST_Polygonize the linework to get a complete set of areas bounded by the linework ST_PointOnSurface the areas to get points ST_Intersects the points with the original polygons and Count(*) ...


2

It's not a bug, more like a strategic laziness. 1.X versions of PostGIS only supported GEOMETRYCOLLECTION EMPTY, not other forms of empty. For 2.X I (perhaps foolishly) embraced the full variety of nothings. The result is a not-entirely-complete support of varieties of nothing, made slightly ill-formed by the fact that support libraries like GEOS have their ...


0

You've got few ways to do this: Draw the point in upper left corner of geometry and order by distance from this point Order by added coordinates of upper left vertex of both geometries Select * from ( SELECT ((ST_Dump(ST_Split(circle, line))).geom) As wkt FROM ( SELECT ST_GeomFromText('LINESTRING(73.3864598921383 ...


1

What do you mean by no spatial view. You mean you are not seeing it in geometry_columns table or your viewer is not loading it? If you are using PostGIS 1.5 or lower, you have to manually add the view to the table geometry_columns table. In PostGIS 2.0+, it will show in list but won't show type. To get type you need to do cast it. Also many views like ...


0

There is likely a problem with your SQL in the subquery... If you are putting this query as the subquery EXACTLY... SELECT * FROM shortest_path_astar(' SELECT gid as id, source::integer, target::integer, length(the_geom)::double precision as cost, x1, y1, x2, y2 ...


0

Based on that answer I'm trying to create new poygon layer that is extent of base layer (also polygon). But statement doesn't work: CREATE OR REPLACE VIEW xxx.extent AS SELECT ST_SetSRID(ST_Extent(geom), 2180) as geom from xxx.buildings_2013; But resulting table isn't spatial. Geometry column in table buildings_2013 is named geom.


0

I Finally found the relevant post from Paul Norman and Andre Joost on a similar Question .. What is occuring appears to be a somewhat subtle bug with osm2pgsql where osm2pgsql requires id-sorted nodes, but the API does not guarantee that. The easiest solution is to import with --slim --drop. The --slim flag causes osm2pgsql to use the database instead of ...



Top 50 recent answers are included