New answers tagged

2

ENVI grids are a simple flat-binary raster file with an accompanying ASCII header file You don't need to convert an ENVI grid to a shapefile to open in ArcMap, it can open it as is. I don't use MapInfo so can't comment on that software. Regardless, even if ArcMap and MapInfo could not read ENVI grids, I would not convert from a raster to a vector format. ...


0

INSTALL NODE FIRST -- https://www.guru99.com/download-install-node-js.html OPEN powershell install $geojsplit PS c:\users\rakesh>$geojsplit and now go to your geojson file location and run this script PS D:\Florida>node --max-old-space-size=500 C:\Users\rakesh\AppData\Roaming\npm\node_modules\geojsplit\bin\geojsplit -a 1 -l 30000 -v -o k D:/florida/...


3

I tried this code and it worked import geopandas as gp from shapely.geometry import Point metersteps=10 planningarea=gp.read_file('california.shp') planningarea=planningarea.to_crs(epsg=32633) # you can leave this out or replace with any other envelope=planningarea.geometry.envelope envelopecoords=list(envelope.geometry.exterior[0].coords) urtuple=...


1

As a complement to @Francisc0Camello answer. If you want to change the order of the features inside the shapefile permanently, you can use the Order by Expression tool. You can use a single column, or you can create an expression that combines several columns to order by several columns. For example, the following example would sort features by state, and ...


1

This is a known bug in QGIS 3.2. https://issues.qgis.org/issues/19299, answered in this post Attribute Table Default Order in QGIS In QGIS 3.x the attribute rows are shown in attribute table by the order of which each one was created. Try to open your shapefile and put the mouse pointer on the first line like in the image below and QGIS will show you the ...


5

From the InsertCursor documentation: Opening simultaneous insert or update operations on the same workspace using different cursors requires the start of an edit session. Since you're not closing the cursor, it remains open during the next run. Try using the following pattern instead: with arcpy.da.InsertCuror('points', ['SHAPE@XY', 'Id']) as cursor: ...


0

With shapefiles that is not possible. You can have all kind of geometries in the same table in PostGIS, GeoPackage, SpatiaLite and Oracle if the table is created without geometry constraints. The native format (JML) of OpenJUMP can also contain any kind of geometries as a mixture. Another question is which softwate can handle such mixed data. QGIS and ESRI ...


-1

you can buffer the lineshapes with appropiate size and by doing this change it into polygone. Afterwards clip and merge.


0

Nope. GIS datasets can only support one type of geometry at a time. What you can do however is package those layers into a single Geopackage (or spatialite, or geodatabase). This is a lightweight database which can store multiple layers within a single file. GIS will treat them as seperate layers so they won't be merged, but it's tidier for storage and ...


3

Use 'Split Vector Layer' in the Vector General Toolbox


1

To make the test.to_crs() function work use as input the corresponding proj4 string, i.e.: test = test.to_crs("+proj=cea +lon_0=-117.333333333333 +lat_ts=33.75 +x_0=0 +y_0=0 +ellps=clrk66 +datum=NAD27 +units=m +no_defs")


1

I believe what you are looking for is rioxarray. An example of what you want to do is at: https://corteva.github.io/rioxarray/html/examples/clip_geom.html import rioxarray geometries = [ { 'type': 'Polygon', 'coordinates': [[ [425499.18381405267, 4615331.540546387], [425499.18381405267, 4615478.540546387], ...


0

I fixed it. The trouble was in zipper version, default GUI archiver in Ubuntu uses 2.0 version of zip, but Studio requires >2.0. Rezipping via console was helpful.


0

Microsoft opensourced building they created with their machine learning they have a geojson for each state on github it's now part of OSM too


7

Zipping all the parts is the usual way of transferring shapefiles, yes, and its the best we've come up with. This is one problem with the shapefile format which is overcome by the GeoPackage format - if your software can save or export your data to a "GeoPackage", and the person you are sending it to has software that can read GeoPackages, then you could ...


1

This is an issue with using curves and a shapefile. Curve geometry is only supported in feature classes (in a geodabase). Shapefiles do not actually support curved geometry. The software still allows you to draw/edit shapefiles with the curve editing tools, making it look like it supports curves. But it will auto re-draw the curve with numerous short ...


-1

The best way to export to kml in qgis is by using the mmqgis plugin. https://plugins.qgis.org/plugins/mmqgis/


5

Given two sets of features A and B coloured red and blue: Then select only those from A that don't overlap any B and vice versa: > Adash = A[lengths(st_intersects(A,B))==0,] > Bdash = B[lengths(st_intersects(B,A))==0,] this works by virtue of the element of the intersection list having zero-length when a feature has no intersections. When plotted:


2

Using shp2geojson.js library it is possible to load ESRI shapefile and convert it to standard GeoJSON object that can then be used to create overlay in OpenLayers 3. Below is simple example of such usage. Shapefile Mexico_and_US_Border.zip is loaded directly from https://opendata.arcgis.com/ site and then added as overlay over OSM map. The only critical ...


1

Column heading capitalization should not affect the join. Try renaming the %Margin column in your csv to PctMargin. Also, remove the % symbol from the end of that columns values. Non-alphanumeric characters can cause problems.


4

Duplicating the layer in QGIS Canvas does not mean creating a new shapefile in your hard disk (HDD), you are still referencing to the same shapefile in your HDD. To create a new shapefile you need to right-click -> Export -> Save feature as and create a new shapefile. Before exporting to a new shapefile, you can uncheck the fields that you do not ...


3

You can use Extract vertices tool to get the corner points of the polygon shapefile, then use Add geometry attributes to add the x and y coordinates of the corner points. Extract vertices tool is located in Processing toolbox -> Vector geometry -> Extract vertices tool. Add Add geometry attributes tool is located from Vector main menu -> Geometry ...


2

The problem with this: plot(st_transform(MEco$geom,laea)) is that some of the vertices are quite far apart in lat-long, and even more far apart in LAEA, so you get a big straight line joining them rather than following the true projected shape. Add more vertices to your shapes with st_segmentize: plot(st_transform(st_segmentize(MEco$geom,10000),laea)) ...


6

as the above people commented, the problem is that you are trying to join uppercase attribute values in the csv with non-uppercase attribute values in the geometries attribute table. Using the field calculator you can either update your COUNTY_NAM field to uppercase by setting it to upper( "COUNTY_NAM " ) or create a new field to use for the join.


2

Here is some boiler plate code to set up active view events. You'll just need to write a function that checks if the item added is a shapefile. Call that function from Events_ItemAdded(). public static IActiveViewEvents_Event ActiveViewEvent; private void WireDocumentEvents() { // Event handlers ArcMap.Events.CloseDocument +=...


3

The event handler for capturing layers added to the map is IActiveViewEvents.ItemAdded Make sure its pointing to a Map and not PageLayout. You would then test to see if it is specifically a shapefile.


0

map.on('pm:edit', function (e) { should be drawnItems.on('pm:edit', function (e) { e is not very helpful without a lot of work. It does not contain the ID of the shape being edited nor does it contain the selected vertex. You would have to compare the e._layers to an earlier copy to get meaningful data.


0

I belive you would want to make a 50km buffer around the municipalities (as stated before). Once the buffer has been applied, you can open the attribute table and see which conservation units fall within the boundaries. You can then right click on the layer, Export, Save Feature As, select the format you want to save in (likely Shapefile), name the Shapefile ...


1

you can try this script: open your python console in qgis and copy/paste the following code: def extract_polygons(shapefile,lyrname,textfile): lyr = QgsVectorLayer(shapefile,lyrname, 'ogr') ft = lyr.getFeatures() with open(textfile, 'w') as o: for feature in ft: geom = feature.geometry() polygon = geom.asPolygon()...


2

QGIS can read NetCDF vector files but has no visible support for writing them at the moment: https://github.com/qgis/QGIS/issues/30492 You can use GDAL's ogr2ogr though: ogr2ogr -F netCDF output.nc input.shp Make sure you throughly read through https://gdal.org/drivers/vector/netcdf.html so that your output is not accidently broken or misleading.


1

Try this: for i in range(0,intersection_origem.length): if intersection_origem[i]: print(intersection_origem[i]) empty strings and None both evaluate to false. See here for more info about what is truthy and falsey in Python. By the way, it is not recommended to iterate through lists the way you are doing in Python. A more "pythonic" way of ...


0

Apparently, leaflet uses EPSG:4326 for input and output, so reprojecting the shapefiles isn't necessary in the first place. When not reprojecting the shapefiles from 4326 to 3857, they are displayed correctly. The shift appears to be a bug in a library. See also https://github.com/calvinmetcalf/leaflet.shapefile/issues/60


0

I understand that you have a large road network that you are interested in and would like to discard the 'small networks' that consist of fewer number of links (like the one on the top right). I would approach the problem like this: merge all the polylines that touch/intersect (let's say this wields merged_network) - see Join / merge lines that touch and ...


1

Easiest way is to use the QuickOSM Plugin. Here is a guide on how to use it. http://jonathansoma.com/lede/foundations-2018/qgis/osm/


1

The OSM Wiki page about Shapefiles has a list of services for Obtaining_shapefiles_from_OSM_data. A few examples from this list: http://download.geofabrik.de/ https://osmdata.openstreetmap.de/ http://osm2shp.ru/ https://download.bbbike.org/osm/bbbike/ There are various other and of course you can create your own shapefiles from OSM data.


0

@mrputter's solution is a good start, but I want to use the s2cells as a grid for snapping purposes so I don't need the full coordinates for every cell. With that in mind, I can afford to just store the first vertex (e.g. bottom left corner), so instead of storing 4 lines (=4 pairs of points) each cell can be represented by one point. Hence, his solution can ...


1

Not sure if you got this working but the easiest way is to use QGIS which is essentially a GUI for ogr2ogr. If you load in your .TAB file into QGIS you can right click in the layers panel and click Export > Save Features As.. From here you can select a number of formats to save as. Chris


1

I ended up using the following: http://overpass-turbo.eu/ [out:json];relation(271888);>;out; downloaded it and then converted it to shp https://mygeodata.cloud/converter/geojson-to-shp


4

The following both commands should work with double quotes "" surrounding the file format "ESRI Shapefile" and with or without double quotes "" surrounding the files names: ogr2ogr -f "ESRI Shapefile" "file.shp" "file.tab" Or ogr2ogr -f "ESRI Shapefile" file.shp file.tab But using single quotes '' surrounding the file format 'ESRI Shapefile' will raise ...


0

.lyr or shapefile are not directly supported yet in cesium. https://github.com/AnalyticalGraphicsInc/cesium-ion-community/issues/7 https://groups.google.com/forum/#!topic/cesium-dev/XXK-Ap4qRg4 but you always export it to kml or geojson and upload to cesium.


-2

Create new field then Use the field calculator create an expression


0

It sounds like the CRS is incorrectly defined for one of the layers (or both). Add a basemap from the QuickMapServices plugin. Compare both of your layers to the basemap. See if either of your layers is in the correct location or not. Focus on correcting the CRS of whichever layer displays in the wrong location compared to the QMS basemap. You'll need to ...


1

Although this post is quite old, I was facing a similar problem and sloved it like this: layerDefn = layer.GetLayerDefn() for i in range(layerDefn.GetFieldCount()): fieldDefn = layerDefn.GetFieldDefn(i) fieldName = fieldDefn.GetName() fieldDefn.SetName(fieldName.upper())


0

I found my mistake. The shapefiles were polygons and after I converted them into multipatches everything works fine again. I don't know if this is the general solution now, but in my case it works fine. Thanks for your replies and help


1

Make sure that the files exist where you think they do. This is generally part of good script writing: before trying to read a file, assert that it exists. Here's one possible adaptation of your code, using assert to test the return value of os.path.exists with your proposed file path as input: import os import numpy as np import pandas as pd import ...


3

If you're willing to use GRASS, you can do this with the v.clean module, choosing the rmdangle tool, and a suitable threshold. # STart GRASS using your polyline shapefile (to determine the coordinate system for a new location) grass -c polyline.shp YourPathToGISDBASE/YourLocation/YourMapset # Import the shapefile v.import polyline.shp output=polylines # And ...


0

I am not sure you are still searching for an answer but I had the same issue. By changing attribute as mentioned here and forcing the qlonglong / Integer64 to double/double and refactoring the data, I was able to select the changed fields as interpolation attribute. Hope it will work for you too.


1

If it's the KML type, then that's the FME format attribute kml_name. You have it exposed in the reader, but then you need to connect it to something in the writer for it to get written. Best solution is to use Manual for the output schema and add a new attribute (such as kmltype). Then use an AttributeManager to rename the incoming kml_name to kmltype on ...


0

Mostly likely you will have to dig deeper and expose the Format Attributes... There can be many for kml but a good start is to expose the kml_description/raw_text/document attributes. Here is an example.


2

Duplicating a layer is not the same as making a copy of the source data. Duplicating a layer When you duplicate a layer, QGIS creates a second link to the same source file. Any edits you make to the duplicate layer are made to the source file. Any layers that link to that same source file will also have those changes. To duplicate a layer, right click on ...


Top 50 recent answers are included