New answers tagged

2

A translation moves geometries. You said you only want to scale them. So do not enter offsets for a translation.


0

As stated in the comments and in the answer by @Zoltan, you can do that by using the -sql parameter. In this case you can use either OGRSQL or SQLite dialect. The syntax is a bit different because with OGRSQL geometry is selected automatically. With SQLite dialect you must select also geometry. Sometimes it may be necessary to rename the geometry to match ...


0

You may use -m switch of shp2pgsql in the command line. Before it you have to create a simple text file with new and old column names (space separated, no leading or trailing spaces). In your case for example in columns.map file: country_id id country_name name_en country_name_de name_de ... Then use the following command: shp2pgsql -m columns.map ...


6

Shapefiles require three files (ESRI Shapefile Technical Description): main file; example.shp index file; example.shx dBASE table; example.dbf An ESRI shapefile consists of a main file, an index file, and a dBASE table. The main file is a direct access, variable-record-length file in which each record describes a shape with a list of its vertices. In the ...


0

You can use the add geometry attributes from the menu vector or the processing toolbox, see the documentation: https://docs.qgis.org/3.10/en/docs/user_manual/processing_algs/qgis/vectorgeometry.html#add-geometry-attributes This calculates the perimeter. Use the field calculator to divide this value by 2 to get half the perimeter.


2

GeoPandas now pass kwargs to shapely, so you can do below now: gdf.geometry.to_crs("epsg:3857").buffer(10, cap_style=2) PR: https://github.com/geopandas/geopandas/pull/535


0

I did not have success with any of the solutions here but I was able come up with a solution that worked using Python's shapely and fiona modules. It uses a tab-delineated .ascii file (my preference as opposed to .csv) but can easily be adapted to use a .csv as in the question posed. Hopefully this is helpful someone else trying to automate this same task. # ...


0

I just put together this piece of code to do this task. It uses a tab-delineated .ascii file as the input and creates a simple .shp file in an unspecified Lat Long projection. Hopefully it can help someone else trying to do this. # ------------------------------------------------------ # IMPORTS # ------------------------------------------------------ ...


1

I had the same problem and used the shp2pgsql-gui.exe that you can find at C:\Program Files\PostgreSQL\9.6\bin\postgisgui, it works fine.


0

You can use gipong/shp2geojson : first, you convert the shp file into geojson data Then you add your data to your map var map = new ol.Map({ layers: [ new ol.layer.Tile({ source: new ol.source.OSM() }) ], target: 'map', view: new ol.View({ center: [0, 0], zoom: 5 }) }); loadshp({ url: 'demo/...


0

Calculations shown in the popup are getting calculated on the fly based on marker location. You can use their implementation to get all text shown for particular location. I have created a demo https://jsfiddle.net/310fm6se/1/. you can enter latitude & longitude to get calculated eclipse times. This can be also used to automate and calculate eclipse ...


0

I imported my point files as a delimininated text layer (originally) and was unable to edit. If you then save layer as a shapefile or export as a geopackage, this might help. It did for me but mine was originally a different file format


0

Assuming you find a way to convert dbf to csv (this link shows how to do it from the command line using LibreOffice), you could then use the Linux join command from a script to merge one file at a time. You would use something like sed to deal with renaming the column headings. You could then do a join in Qgis to reconnect the data to the geometry. (Or to be ...


0

Unless you want to go the complicated route of building a full planar topology in e.g. something like PostGIS, and then generalizing this topology rather than the original data to avoid producting these type of inconsistencies and overlaps between neighbouring polygons, I think using something like ArcGIS's Integrate tool is your most realistic option to ...


1

You would add an attribute to the file. For example using the Processing Toolbox and "Add field to attribute table" tool. Make sure you select String as Field type if you want the degree character °. Then edit the lines with the text you want in the attribute column. Open the attribute table, toggle editing on, select the line you want, which will ...


1

You have a multi-part polygon. You want to split it into individual polygons. You can do this with Multipart to Single Parts in the Vector toolset. See this answer for more details.


0

Your code is incomplete so impossible to tell whats wrong. But this is working when I try: import geopandas as gpd from shapely.geometry import LineString coords = [(377205.43543222273, 2464301.85113062), (377235.43946816603, 2464301.85113062), (377235.43946816603, 2464241.855100152), (377205.43543222273, 2464241.855100152), (...


0

The shapely dont export to shapefile. I think that the geopandas do that due the Fiona. So, I recommend you to create a GeoDataFrame and then just create the shapefile with the method geoDataFrame.to_file("<>.shp").


6

You have created a new (empty) layer instead of opening an existing layer. As a file with the same name as the new empty layer already existed, you would have seen a message "The layer already exists, Are you sure you want to overwrite the existing file?". Since you clicked "yes"/"ok", you have saved your newly created empty ...


0

When you run your code as you have it now, interest isn't filled in at all - it's set to null for every value. This is because you're mixing server- and client-side objects, which you can't do in earth engine. countyID is a client-side variable (since you initialize it using var), while the value assigned to OBJECTID is server-side. Even if their values are ...


0

The existing answers did not work for me (fiona 1.8.13, geopandas 0.8.0). The ESRI shapefile format supports python's date class, but not the datetime class https://github.com/Toblerity/Fiona/issues/572. Instead of this: gdf['datetime'] = pd.to_datetime(x) # datetime Use this: gdf['date'] = pd.to_datetime(x).date() # date gdf['time'] = pd.to_datetime(x)....


6

Run the command with -d switch https://postgis.net/docs/using_postgis_dbmanagement.html#shp2pgsql_usage -d Drops the database table before creating a new table with the data in the Shape file. for overwriting the table that you have created with your previous trials. The first error message tries to help ERROR: relation "geo_br" already exists.


1

So i found that by making the conversion as I suggested above, but adding * to the last line (for unpacking the tuple), it seems to be working correctly now. Corrected code: # Create a reader instance for our US Roads shapefile r = shapefile.Reader(loc) # Create a writer instance copying the reader's shapefile type save = saveloc + "\\" + "...


4

I would suggest using the geopandas and shapely libraries for this operation, this will require much less code to achieve the same operation. You can create a Polygon for your BBOX to which your shapefile has to be clipped. import geopandas as gpd from shapely.geometry import Polygon shp = gpd.read_file("roadtrl020.shp") xmin, xmax, ymin, ymax = -...


0

I found usable free shp files at https://tapiquen-sig.jimdofree.com/english-version/free-downloads/europe/.


0

Your projection (WGS84 EPSG:4326) is incorrect, the coordinates look to be in metres, they're definitely not decimal degrees. You need to assign the correct projection. The correct projection could be anything, but if you digitised off a basemap, it may be WGS 84 / Pseudo-Mercator EPSG:3857.


0

I now realized my mistake. I extracted the coordinates from google earth and instead of getting the data under coordinates (which is placed in the last column when you open a .kml file thru excel), I used the data under latitude and longtitude. When i checked the data, numbers under the lat and lon are mostly the same. Anyway, sorry for all the fuss. thank ...


0

I got this same error: ERROR: function addgeometrycolumn(unknown, unknown, unknown, integer, unknown, integer and turned out it was because I didn't have PostGIS installed. More info here: http://www.silota.com/docs/sql-load-data/shapefile-postgis.html ogr2ogr to a postgres db only works if you have PostgresSQL and PostGIS installed (and a postgis table ...


1

I realize this is quite old but just came across the same issue and wanted to share a solution. Strictly speaking John Powell is right – it can't be the same format because it needs to be converted on import to a PostGIS-supported form. However, using ogr2ogr you have some control over how this happens: Something like $ ogr2ogr -f "PostgreSQL" &...


2

Raster files, like tiff images, cannot be directly converted into vector formats. However, it is possible to convert each pixel into small rectangular polygon and save the polygons as vectors into some vector format like shapefile. Some utility programs, like gdal_polygonize https://gdal.org/programs/gdal_polygonize.html, can do a little bit more and merge ...


3

Shapefiles utilize IEEE 64-bit floating-point representation to store coordinates. They have a precision of at least micrometres at the Equator and 180th meridian using decimal degrees, far in excess of the capabilities of geodata collection. Shapefiles can map the logic gates of modern semiconductor CPUs within a UTM zone, if x-ray crystallography or a ...


1

Given all of the political and military contention surrounding Pakistan's borders through the years, my guess is that you are seeing some "version" of the border on Google Maps that does not match your own understanding of the border. Try checking other sources too, like OpenStreetMap It is also possible that the shapefile you are using is intended ...


6

A shapefile is capable of representing features on the ground to within a centimetre of precision. Disagreements between two spatial data sets that claim to represent the same entity may occur for several reasons. Representing a curved border with centimetre precision requires a lot of points along the border. This makes your data set very very large. In ...


0

Try here: https://mydata.biz/ru/catalog/databases/borders_ru ; there are 9 levels to choose from, the most detailed of which is level 8.


5

GeoPandas is an addon to Pandas where a geometry column has special meaning and writing output writes geospatial file formats. If you want to export just the non-spatial data, the easiest way would be to create a plain Pandas DataFrame from your GeoDataframe, so the geometry column loses its special meaning, and then remove it. To do so in one "step&...


0

If needed, you can convert your dataframe to pandas dataframe and save it with: https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.to_json.html so something like: df = pd.DataFrame(gdf) df.to_json(output) You might have to select columns without geometry. columns_without_geom = gdf.columns if 'geometry' in columns_without_geom: ...


1

I had the same problem. Vector bender don't work for me, in QGIS 3.10. I solved with SAGA Warping Shapes (acessible on processing painel). Its work well with Affine method. http://www.saga-gis.org/saga_tool_doc/2.2.5/pj_georeference_2.html


2

To my experience, using MS Excel sheet in ArcGIS may cause issues sooner or later, since Excel sheet is not literally a database. A recent edit in your sheet may have caused this issue. If you visit this very informative page, https://desktop.arcgis.com/en/arcmap/latest/manage-data/tables/understanding-how-to-use-microsoft-excel-files-in-arcgis.htm, it ...


2

So, in order to create a shapefile from an ee asset I propose the following solution, feel free to improve it : rootDir = os.path.expanduser('~') + '/' asset = 'users/bornToBeAlive/aoi_PU' aoi = ee.FeatureCollection(asset) aoiJson = geemap.ee_to_geojson(aoi) aoiShp = sg.shape(aoiJson['features'][0]['geometry']) Then you need to create your shapefile (it ...


0

If you are not constrained to using ArcMap, take a look at Flowmap.blue. It can handle 300K flows.


0

If your layer is geolocated so you can add the x & y coordinates to your attribute table by just adding the fields $x and $y to the attribute table. Getting list of coordinates for points in layer using QGIS?


0

If it does not work with the xls file, convert your excel file to delimited text format (csv), using UTF-8 as encoding. You can load it to QGIS even without having a geometry, only a table with "naked" attributes as a non spatial table: https://docs.qgis.org/3.10/en/docs/user_manual/working_with_vector/attribute_table.html#foreword-spatial-and-non-...


2

If you have a unique key/ID in your shape and xls (may be UNIFORM_ID), then you can join the shape and xls. Open your shape file and the xls in QGIS. Open the xls as a vector layer (you have to select all files from the file type list to see xls files), it will be a table without gemometry in QGIS. Open the properties of the shape file and select the Join ...


1

shp2geojson.js can take a File object as url, so you could simply drag and drop zipped shapefiles onto the map from a network drive http://mikenunn.16mb.com/demo/shp.html <!DOCTYPE html> <html> <head> <title>Load SHP overlay</title> <link rel="stylesheet" href="https://openlayers.org/en/v6.3.1/css/ol....


0

I know what you mean. My first recommendation is applying an appropriate client-server architecture that follows OGC standards. Among OGC standards, WMS and WFS are very popular to retrieve spatial data stored in database in order to display as a map layer. If you don't want to store shape file into database, you may have two alternatives: Using Geoserver ...


0

From a (very) high level, for users to upload their own shapefiles and have your server manage the display/tiling/interactivity, as if it's any other layer, you will need to.. Create a dialog in your UI where they can select a file from their system to upload to your server. Write a web service of some sort that.. a) receives the uploaded file b) stores it ...


Top 50 recent answers are included