![stata ssc geodist stata ssc geodist](https://static.wixstatic.com/media/16eebe_d91647399b0b432e8043f5c31cca10a7~mv2.png)
I am not sure if this is exactly what you want, I don't have any experience with geo2xy in Stata, but with regular twoway and a bit of algebra you can get approximate values for these scales (especially since you say you're working on a small scale where approximating is okay) Here's what the map looks like if I let Stata decide on the labels: If you do so, Stata will likely rescale each axis to fit nice intervals and will therefore change the proportions a bit. If you want to display axis units (in meters), you can remove the xlabel() and ylabel() lines. Graph export my_map.png, width(600) replace Plotregion(margin(small)) graphregion(margin(small)) /// * the projection is in meters, centered on mid-longitude, center y coor as well * show the projection details and compute the plot's height Geo2xy lat lon, gen(ylat xlon) project(mercator) * project lat/lon to (x,y) in meters using a Mercator projection When creating a map in Stata, you need to be sure to create a map region that has the correct proportions (xsize() and ysize() are proportional to the distance). To center them on the middle of the map, all you need is to offset them from the mean. The y-coordinates are in meters from the equator. The projection is centered at mid-longitude by default which means that x-coordinates will be in meters from the center of the map. Since you want coordinates that are based on distance units, I chose a true Mercator projection which creates (x,y) coordinates in meters. With geo2xy (from SSC), you can use the same projection that Google Maps uses so the map you create will have exactly the same proportion that you would observe on Google Maps. If you are going to create a map with geographic coordinates, you first need to convert these to planar (x,y) coordinates. So, how can I create a scale bar for each of x and y to show what, for example, 100m looks like? In this example, the y scale would look different than the x scale, so maybe I need to find a way to change the y-ranges and x-ranges so that they can represent the same scale? But for what I need this visualization for, and the fact that these data are usally clustered within 2km of each other, its accurate enough. the distance from ymin to ymax/2 may not be precisely the same as half the distance between ymin and ymax). Note: I know that on a spherical projection of the earth the distance between ymin and ymax may not map perfectly onto subsets of that distance (e.g. Now, we can get a sense of the distance between the minimum and maximum latitude/longitude using the following: * Store x and y ranges in localsįor this data, y spans 0.2km and x spans 0.329km. This is great, but I have no idea how far the points actually are from each other. You should get a lovely basic scatterplot. * Create y/x axis ranges using min and max latitude and longitude
Stata ssc geodist install#
If _rc = 111 ssc install geodist // Installs geodist if necessary * Install Geodist (we will need this later)
Stata ssc geodist code#
Here is some code to input a few coordinates and graph a scatterplot, specifying the axis ranges: * Input example data
![stata ssc geodist stata ssc geodist](https://i0.wp.com/thedatahall.com/wp-content/uploads/2020/06/calculate-distance-in-stata-using-geodist.png)
I would like to add a scale bar for both the x and y axes to get a sense of how far apart the points actually are. This is just to visualize where the points are for some quick validation.
Stata ssc geodist series#
Please note that the ‘GeoDist’ project is released with a ContributorĬode of Conduct.I am graphing a series of GPS points using twoway scatter in Stata. #> r.ref has been stored in temporary directory: /tmp/RtmpFcgDIi/r.ref.grd # All path from "from" to all "to" This conducts to potential error of 0.095178 % of distances calculated. # basic example code crs_merc step.ang was set to 5 degrees. #> Loading required package: geoR #> - #> Analysis of Geostatistical Data #> For an Introduction to geoR go to #> geoR version 1.7-5.2.1 (built on ) is now loaded #>.