Since .mbtiles is raster data, is there possibility to extract this data and metadata contained in file (per point) to CSV or Excel file with coordinates + this additional metadata. So to have a row with:
lat: 123.123 long: 456.456 metadata: "Some metadata"
The best I can do is load .mbtiles file to QGIS, and now I'm trying to vectorize the layer and export single dots to coordinates. Problem is that dots are actually circles that sometimes overlap, so I cannot get exact position of all the dots. Also, I miss the metadata that is in .mbtiles files.
Thanks.
This is a onliner you probably look for (requires SQLite installed: http://www.sqlite.org/download.html):
% sqlite3 -header -csv world_countries.mbtiles -separator ; "select * from metadata;" > world_countries.csv
Related
I have an unstructure grid in vtk file ( with legacy format), these file describe a points, cells and cell type. How can I generate a vtk structured point from this unstructure grid ?, or a 3d image file (with voxel information)?
You can start converting your vtkUnstructuredGrid to a vtkPolyData, see an example here . Then you can use vtkImplicitModeller to build a vtkImageData (voxels) from your vtkPolyData, see an example here . These are C++ examples, I'm sure you can find Python examples if needed.
I have a big GeoJson file and I need to convert it to the vector format that can be loaded by the Mapbox. I need to have an external file, so I can't use Mapbox Studio for uploading and converting the data.
Currently I found https://github.com/mapbox/tippecanoe tool, but it converts GEoJSON to MBTiles (SQLite format). I think a can't use it for my map. As I can see from all the examples of the Mapbox service - it uses a XXX.vector.pbf (protobuf) format (small and fast). So the question is - how to get a Protobuf vector file from the original GeoJSON ? Thanks!
Tippecanoe is probably the right answer: it generates a ton of .pbf files, and bundles them into a single .mbtiles file. Usually you then pass that .mbtiles file to a vector tile server (there are heaps), or upload it to Mapbox or something.
If you want to explode out the .mbtiles file, you can use mbutil.
Finally, if you want to translate GeoJSON directly into protobuf format (different from the Mapbox vector tile format, I think), you can use GeoBuf.
I want to export matlab output to an excel file starting from G2 column and for this the code i had written is exporting the data correctly but not to the desired location .It is printing in 21st number of rows rather than 2nd.
the code is
ResultFile = xlsread('filename');
sz= size(ResultFile,1);
b= num2str(sz+1);
location = strcat('G2',b);
fprintf('value in location is %g\n',location);
xlswrite('filename',fnlarray,'Sheet1',location);
In the command
xlswrite(filename,A,sheet,xlRange)
you can either specify xlRange as a string defining the corners of the desired output region, or (provided that you have specified the sheet) only give the coordinates of the upper-left cell. If you want to write an array to a region "below and to the right of G2", this should be enough:
location = 'G2';
Concatenating 'G2' with the number of rows of the excel file + 1 does not really seem to make sense to me right now.
I have been dealing with a lot of shape files editing tools last month..
I tried to get two dbf files from shape file (one for nodes and one for links) in an appropriate format (node_id,x,y for nodes and link_id,start_node_id,end_node_id,...for links)in order to create an oracle spatial network.
I got the dbf for nodes..
I want now to get the attribute table from a loaded shape file containing polylines (roads) and I want to split each polyline to its segments containing their start and end node id's besides their geometry..
Every help accepted..
You might want to clarify your question slightly, but it sounds like you want to get the details of each point in a polyline from a shapefile so that you can define segments.
I wrote an example of how you can do this using Python here:
https://gis.stackexchange.com/questions/40798/how-to-split-shapefile-per-feature-in-python-using-gdal
Specifically, pay attention to the lines:
line = geom.asPolyline()
# all points in the line
for point in line:
You should be able to achieve your goal using a variation of this basic example.
Dan
If i have a grib2 file that contains information for whole world (for some parameters) and I want to extract data from it using wgrib2 based on latitude and longitude given by user (client software to server). I tried following command but I am getting complete grib2 file only:
wgrib2.exe input.grb -undefine out-box 10:90 -10:10 -grib output.grb
Please tell me where am I going wrong? Thanks.
This is still the top hit on Google, so even though it is a bit old, here is a more detailed explanation.
First, you need wgrib2 from the National Weather Service Climate Prediction Centre. (The installation of that is straightforward, but not too well explained. See this page, or this gist for help.)
Next, you need to use the lola function (for LOngitude-LAtitude grid).
You need to give wgrib2 several arguments:
the grib file that has the data
the longitude information:
the longitude of the southwest corner of your bounding box
the length of the bounding box in degrees
the spacing of the points in this direction
the latitude information, the same as above
the latitude of the southwest corner of your bounding box
the length of the bounding box in degrees
the spacing of the points in this direction
the file name to write to
the format of the file to write (either bin for binary, text for simple text, spread for spreadsheet format, or grib for grib2).
For example:
wgrib2 input.grb 220:100:1 20:50:1 output.grb2 grib
will create an output file that covers north america (220 E - 320 E; 20 N - 70 N) at 1 degree intervals in both directions.
Rob
I used the following command to extract information from grib2 file.
wgrib2.exe input_file.grib2 -lola LonSW:#lon:dlon LatSW:#lat:dlat file format
assuming that we are having following co-ordinates for selection:
Top: (x0,y0) (x1,y0)
Bottom: (x0,y1) (x1,y1)
"LongSW"=x0, #lon = (x0~x1), "LatSW"=y0, #lat = (y0~y1).
and dlon and dlan can be kept as 1. 'file' is the output file name and format can be grib, csv, text etc.
Substitute above values in the command shown above and you should get the answer.
If your chosen longitude was 360 and latitude was 90:
wgrib2.exe input_file.grb2 -lon 360 90 > output_file.txt
I think you can also use cdo directly on grib for this
cdo sellonlatbox,lon1,lon2,lat1,lat2 in.grb out.grb
If the grib file is on a reduced gaussian grid you may need to specify that you want a regular lat-lon output. I usually convert the output format to netcdf myself using "-f nc" as I find it easier to process in other software.