Hot answers tagged

12

When you transform you always transform pair of points: ol.proj.transform([23.4, 42.5], 'EPSG:4326','EPSG:3857'); (this transforms from EPSG 4326 to EPSG 3857; the coordinates are [lon, lat])


8

The correct syntax involves the use of single quotes around the X and Y 'offset_x,offset_y'


7

[EDIT] The original source data is California State Plane Zone 2, i.e. EPSG:2226. The following approach using ogr2ogr will perform a CSV to Shapefile conversion, including the coordinate transformation to Lat/Long (i.e. WGS84) that you're desiring. Basically I'm just adapting the approach demonstrated in this post. For GDAL/OGR < 2.1 you'll need to ...


7

You can do Layer... Save As... and choose the CSV output format. Choose Geometry type as POINT and Geometry as AS_XY: Then you'll get a CSV like: X,Y,route_fid,route_point_id,ele,time,magvar,geoidheight,name,cmt,desc,src,link1_href,link1_text,link1_type,link2_href,link2_text,link2_type,sym,type,fix,sat,hdop,vdop,pdop,ageofdgpsdata,dgpsid -2.57063249857404,...


6

you just need to run a cursor on it and use the projectAs() geometry method. import arcpy fc = r'C:\path_to\your_data\points.shp' wgs = arcpy.SpatialReference(4326) with arcpy.da.UpdateCursor(fc, ['SHAPE@', 'lat_field', 'long_field']) as rows: for row in rows: pnt_wgs = row[0].projectAs(wgs) row[1:] = [pnt_wgs.centroid.Y, pnt_wgs....


6

The QGIS field calculator is pretty powerful. So since the file is in EPSG:3879, it will report x and y in EPSG:3879. I don't quite understand why you think it is reporting in EPSG:3067, perhaps you re-projected the file incorrectly at some stage. But you can get co-ordinates in EPSG:4326 (lat, lon) by re-project within the field calculator. So for X: X(...


5

I think I see what is happening here. If you are in North America (and I think using State Plane for Alabama indicates that you are). You have your x and y switched in your spreadsheet. Latitude (Y) is going to be in the 33 range and Longitude (X) is going to be a negative number (-87 +/-). I see also what Dan is saying. I would probably handle this by ...


5

Yes - the code below uses the SHAPE@XY token and a field called elevation to do it on a test feature class: import arcpy fc = r"C:\temp\test.gdb\pointFC" fields = ['elevation', 'SHAPE@XY'] with arcpy.da.SearchCursor(fc, fields) as cursor: for row in cursor: elev = row[0] coordX = row[1][0] coordY = row[1][1] print "X: {}, Y:...


5

Have you tried converting your csv table to a txt file instead? I have trouble with the csv format on occasion even in 10.2 so I always start first with a txt file, if possible. As for why it happens, I am not sure.


5

I was looking for this function too, and I have found it in some of the examples on their site. You can use ol.proj.fromLonLat([19.062072, 47.473478]). http://openlayers.org/en/v3.13.1/apidoc/ol.proj.html#.fromLonLat


5

I am not seeing any decimal values greater than .59 nor .xx59 in your Excel spreadsheet. I think the spreadsheet has DD.MMmmm (degree-decimal minutes) or DD.MMSSssss (degree-minute-decimal seconds) values, not decimal degrees, DD.ddddddd. Take a look at the spreadsheet to see if you seen any .xxxx values that have >59 in the 3rd and 4th positions. If you can ...


5

The QGIS field calculator can do it with these built-in functions: x( centroid( $geometry )) y( centroid( $geometry )) Make sure to create a new field of type real, with an accuracy of 8. You can even use a virtual field to avoid changing the datasource.


5

Using ogr2ogr The simplest way to do this is probably to just use ogr2ogr, no need for code. Something like this:- ogr2ogr -f GeoJSON -s_srs XXXX -t_srs 4326 output.geojson input.shp Replace XXXX with the CRS of your shapefile. In Python If you want to use Python, you can do this using shapely / fiona / pyproj. This will be slower than ogr2ogr, but more ...


5

What I would do is create the shapefile first in WGS84. This creates a shapefile with geometry in WGS84 Decimal Degrees, and a good starting point for any dataset that originates from decimal degree coordinates. Then, create a new copy of your data in EPSG:26986 by right-clicking the layer, Save as > then set the CRS to EPSG:26986. Then when you save the ...


5

To get this into a useful format as a CSV is going to take some doing. The first step is to open the data in a text editor (like Notepad) and replace the semicolons with commas (edit>replace, or ctrl-h). That gives you a group of items (with internal spaces), separated by commas, as below: Note that I am only using points that you have listed as "Row 1" ...


4

Join the table with XY information to the table without it. From there, you can add permanent XY fields by exporting the joined data.. You can also do this by adding the XY fields first. Then joining the tables, and calculating the XY values using the joined XY fields. After you have done this, remove the join and you will have a XY fields for the table ...


4

It works with 10.1, so it's looks like a bug of 10.2. If you are in this situation: ArcMap crashes when an XY event layer is in the data frame and the Get Point Features dialog box is opened from the Find Route tool you appear to be encountering bug NIM094607 which is due to be fixed at ArcGIS 10.2.1. Maybe you could try to export your data in a ...


4

I created a fork of your JSFiddle that implements what I've suggested in my comment: http://jsfiddle.net/jLndtt8z/1/. The key piece of information you were missing is that the axisOrientation property of the projection is just a hint to format parsers and serializers, but it does not actually cause any coordinates to be transformed. To flip the y-axis, you ...


4

Here are some alternatives to Select by Location: Intersect (Analysis) Computes a geometric intersection of the input features. Features or portions of features which overlap in all layers and/or feature classes will be written to the output feature class. Clip (Analysis) Extracts input features that overlay the clip features.


4

I would suggest you use the very useful website, which , as @iant has pointed out, is provided by Klokan Technologies GmbH. The official coordinate reference system for the GB is 27700, if you plug that in, you will see the WGS 84 as well as projected (by which they mean 3857, aka Spherical Mercator), which is what is used by most global tile sets you are ...


4

When you import a file into CARTO, CARTO checks if the file contains longitude and latitude column names like (longitude,lon,lng,longitudedecimal,longitud,long,decimallongitude,decimallong,point_longitude,latitude,lat,latitudedecimal,latitud,lati,decimallatitude,decimallat and point_latitude), if CARTO founds them it will use the values of those columns to ...


4

Expanding on the answer of @heikkivesanto, the expression can be made more generic as follows: x( transform( $geometry, layer_property(@layer_id, 'crs'), 'EPSG:4326')) This removes the need to copy in / remember the EPSG code for the layer CRS. Further still: x( transform( $geometry , layer_property( @layer_id ,'crs'), @project_crs ) ) Uses the ...


4

Use the UpdateCursor for this with the SHAPE@X and SHAPE@Y tokens. This will change the data so backup before executing: import arcpy feature_class=r'C:\Default.gdb\Points' #Change to match your data fields=['X_coord','Y_coord'] #Change to match your column names containing x and y coordinates with arcpy.da.UpdateCursor(feature_class,['SHAPE@X','SHAPE@Y']+...


4

In ArcGIS, in every tool windows, you can go to Environments and set a custom extent (or based in another layer): Also, you can set options by Default in Geoprocessing / Environments


4

You'll need a Standard or higher license for this method. Create a buffer feature class from your centerlines with a 5 foot buffer distance. Then use the Snap tool. Your points are your input features. Your centerline buffers are your snap features. Use Edge as your type.


3

I think the issue is that your data is in wgs84 or another projection, but by entering the state plane projection into the event layer dialog, you are telling arcgis that your input data is in state plane already. you would need to set the coordinate system of the input to the correct one, and then convert it to state plane.


3

Figured it out - the issue was that the NoData values were NaN, which is not numeric. To have a stretch, all values must be numeric. So, to solve, I re-assigned NaNs as -9999, then used Set Null in Spatial Analyst to ignore all values equal to -9999. -sam


3

From the syntax you used in your post it seems you are using VBScript in the field calculator. If that's the case you can use the FormatNumber function to control how many decimal places are printed during the concatenation. This article from ESRI discusses using the function to produce labels, its discussion of the function syntax may be useful in getting ...


3

Yes, it is documented in the help file in the second to last table. I believe you're looking for <dyn type="dataFrame" name="DataFrameName" property="upperLeft" units="dms" decimalPlaces="4"/> and similar (lowerLeft, upper/lowerRight).


Only top voted, non community-wiki answers of a minimum length are eligible