Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 10 years ago.
Improve this question
I am trying to convert the SVG File to SHP (Shape File format) and then get it imported into GeoServer.
Is there any convertor available OR is there any mediating format in which I can get it converted and finally get it in SHP format?
I already have shape file of Map of India. Now, there are some odd 60 districts got added in recent years. New districts are separate from the old ones. So, the total area of the country has not changed, but got divided.
What I am thinking is, if I can merge the new layer which I have of new districts in SVG format to the original SHP file data and get the final coordinates mapped according to the SHP file, then the problem can be sorted.
If anyone has done it and can help, will be great!! Thanks!!
Highly unlikely. SVG is a 'drawing' format, and so there's no guarantee that the lines have coordinates that are anything in the real world - they might be in centimetres based on a piece of A4-size paper.
So you would have to at least work out the transformation from those coordinates to lat-long, or some other coordinate system. This may be non-linear...
However SVG is an XML-based file, so you can open it in a text editor and get a look at it. If you can figure out what elements hold the coordinates you need, then you can write a script (I'd do it in Python, but whatever language you can program in that has XML support will do) to strip out the coordinates. Then it might be possible to think about converting them to a shapefile - or maybe GML - an XML-based standard format for geographical data.
But to be honest, it might be much easier to source a shapefile with the boundaries you want in it.
Related
I'm quite beginner at R so I'm struggling with what I've found on google for how to plot species occurrence data points in R (I know how in QGIS but my supervisors want R) and then fill in 10km or 1km grid squares where the species has occurred. The photo shows what I mean but has been produced in DMap rosemarybeetlemap
The main issue I have is that my csv file of records only has alphanumeric Ordnance Survey grid references - can R plot with these or do they need to be split into easting/northings or even decimal latitude/longitude? and if so, how?
Any help is greatly appreciated!
Locations detailed in Ordnance Survey’s National Grid (NGR) format in contrast to using eastings and northings (in metres) splits the Great Britain into lettered grid squares and then defines locations within each lettered grid square. You know but some explanation you'll find here as a beginners guide to finding grid references).
For your main issue following article maybe a solution for a first step Converting (British) National Grid references.
I quoted some info below (credits to mikerspencer and Claudia Vitolo).
There’s no need to write a script from scratch to convert grid references, someone has done it already! There is some legwork to do in getting your NGR coordinates in a format ready for the conversion. The script that follows does just that, taking a csv file as your start and end point.
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 1 year ago.
Improve this question
I have two shapefiles of the state of NSW, Australia. The first one has some regions that are useful for economic reasons, while the second has information about the koala population, in much smaller polygons.
Here I show both maps that I get when I plot these shapefiles:
Areas of NSW
Probability of finding a Koala
What I'm attempting to do is to add the region name of the first picture to each of the quadrants of the second file.
Is this possible? Which would be a method to match the polygons of both files? Thanks
You are likely looking for sf::st_join().
What it does is it transfers the non-spatial information from one {sf} object to another based on spatial relation. For the function to work both spatial objects need to have the same CRS (so consider sf::st_transform() if they do not).
Note that the order matters: you either add koala info to administrative areas, or area info to koala regions.
Also note that some koala regions are likely to straddle the border of two regions; these will be split. So expect slightly more rows coming out that what went in.
Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 2 years ago.
Improve this question
How to include images in the bars, in an animated chart bar with R?
The animated chart is based on this code:
https://github.com/amrrs/animated_bar_charts_in_R
I would like to add flags to each bar, as in:
https://www.technologyreview.com/2020/03/27/950263/the-covid-19-pandemic-in-two-animated-charts/
But my flags are personalized, so the package "GGIMAGE" doesn't work. I want to upload my own images.
Hope I didn't ignore some concern of yours, but if it is only that you have your own image files and don't want to use ggimage::geom_flag, then ggimage might still be useful to you - you just have to provide the path to your own image as a parameter to ggimage::geom_image.
It should be easy if you name the flag images simply the same as your country_name+ .png .
Unfortunately I know little about that animation code and the example you shared, so you might need to tamper a little to get the positioning right :)
library(ggimage)
anim <- ggplot(gdp_formatted, [...]) +
[...] +
ggimage::geom_image(
aes(
# x = rank,
y = value,
image = file.path(<path_to_local_folder>, paste0(country_name,'.png')),
# size = ...
)
)
Fair warning, the size aesthetics param was really annoying to me and only by pure luck I got it under control (in my use case, images had different dimensions and needed to be rescaled).
I'd suggest to preprocess them so they fit and just not bother with this part :)
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 3 years ago.
Improve this question
Well I have a network dataset in NodeXL and I am trying to visualize it on a world map. My dataset has
Nodes with an attribute of a country
Links. Unweighted connections between the nodes
I tried to do it with NodeXL and exporting the file and importing to Gephi. But, I cannot find a way to visualize it on a world map in base of the attribute of nodes.
Also, I know about D3.js but I cannot find any example or tutorial with networks on maps.
Can you please provide me with examples in NodeXL, Gephi, D3.js or any other library to do this.
Imagine the result something like this:
In Gephi, you can use a map-based layout to visualize your network based on node location. You need to have two attributes containing the geocoded coordinates of your nodes: latitude and longitude. There are two plugins you can use for the visualization (neither comes with Gephi by default, you have to install them from Tools -> Plugins):
GeoLayout - when you apply that one, you have to specify the names of the attributes where longitude and latitude are recorded and select a projection (e.g. Mercator). Your nodes will be laid out accordingly.
Map of countries - that's a plugin that displays a (fairly crude - not too detailed) outline map as a background to your network.
You can use both in sequence - though frankly I've had more success using GeoLayout, exporting the result to a vector graphic, an overlaying it on top of a map image. If your network is large and nicely spread across the geographic area, you won't even need to overlay it on a map - it will already look like one. In the Facebook visualization you've posted above for example, the outlines of continents emerge just based on where nodes/users are concentrated.
I'm new to R - which will be obvious in a sec here...and I was hoping someone could point me to the some packages to attempt to solve a specific problem:
I get Excel tables from scientists with analytical data for specific GIS point sample locations, we usually copy/paste these tables into the layout of GIS map documents; however quite often the line weights, fonts, etc get messed up...and the data gets updated/revised etc. - tedious copy/paste again...
I'd like to try to read these Excel files, have R create a multiple formatted tables for each sample location, and plot these tables with real world coordinates for use in GIS (ESRI or QGIS, etc.), where the tables would ideally show up offset some distance from the point sample locations in some sort of GIS file format.
I was thinking the export from R might be a .dwg, or even a raster geotiff with a transparent background...a format that would preserve formatting and position - not sure what the possibilities here could be...has anyone ever tried anything like this - I see several excel and geospatial packages, and understand that they can be used for regular geospatial data analysis, but in this case I'm trying to merge graphics (formatted tables from R) and GIS - which is something I'm having a hard time finding any info about.
Hopefully this question is not too vague...
edit - I have the SP package and am reading up on it, I guess I'm really stuck on the whole make several tables with R > get those tables all at once into a format that GIS can read - try this - imagine a georeferenced aerial photo - then imagine a layer of floating boxes on top of the aerial image, these boxes are placed with coordinates (i.e. lat/long, state plane feet, etc.) - can I make a layer like this with R and the geospatial packages?