When loading data from my postgres-db (where I can only read from, so not my own db) the field with the point-coordinates like .. 'POINT(390002.1610814564 6001433.406049595)'  .. are getting (auto)converted into .. 0101000020E964000022936245FEDA1741A4A29D5E0DE85641  Working with coordinate-systems is rather new to me, so can anyone tell me how this converted coordinate is called or how I can convert it back into the previous format? Don't know if this information is helpful, but I'm using django (python) with the following code: try:     with connections['db_second'].cursor() as cursor:         cursor.execute(&quot;SELECT * from ...&quot;)         row = cursor.fetchall() except Exception as e:     cursor.close()
123309
How can I convert WKB to WKT form? I stored coordinates  in WKB but now I  want to display it using WKT form.
41318
I'm working on a school project. I have  from Sacramento, California   I want to convert the XY coordinates to latitude and longitude, in order to import it into tableau and use its mapping features.   I also have the address, if that makes it easier.  I have about 10,000 records, so I need a powerful tool to perform this conversion.
78856
I run the function "Join attributes by location" in Qgis 2.2 between a point vector layer and a polygon vector layer. When I open the resulting table of contents of point layer there is a column of numbers (fields from 10 to 13) that fail, because there is the same value in every row.   In "input" a list of unique numeric values (example: 100000000001, 100000000002, 100000000003...), in output results the same value in every row (example: -12345678, -12345678, -12345678...).
57654
I stand on the following tricky situation:  I have a node with geofield coordinates attached. I am constructing an array of points. Something like:  Array ( [86] =&gt; Array     (         [0] =&gt; Array             (                 [lat] =&gt; 39.1641410477                 [lon] =&gt; -2.633972168             )          [1] =&gt; Array             (                 [lat] =&gt; 41.0420738489                 [lon] =&gt; -2.633972168             )          [2] =&gt; Array             (                 [lat] =&gt; 41.0420738489                 [lon] =&gt; 1.2524414063             )          [3] =&gt; Array             (                 [lat] =&gt; 39.1641410477                 [lon] =&gt; 1.2524414063             )         [4] =&gt; Array             (                 [lat] =&gt; 39.1641410477                 [lon] =&gt; -2.633972168             )     )  [85] =&gt; Array     (         [0] =&gt; Array             (                 [lat] =&gt; 39.1641410477                 [lon] =&gt; -2.633972168             )          [1] =&gt; Array             (                 [lat] =&gt; 41.0420738489                 [lon] =&gt; -2.633972168             )          [2] =&gt; Array             (                 [lat] =&gt; 41.0420738489                 [lon] =&gt; 1.2524414063             )          [3] =&gt; Array             (                 [lat] =&gt; 39.1641410477                 [lon] =&gt; 1.2524414063             )         [4] =&gt; Array             (                 [lat] =&gt; 39.1641410477                 [lon] =&gt; -2.633972168             )     ) )   I want to pass this to my-googlemaps.js in order to be used by google's init map Google map is defined as:  my-map:   header: true js:   js/my-googlemaps.js: { }   https://maps.googleapis.com/maps/api/js?key=my_key&amp;callback=initMap: {type: external, attributes: {defer: true,async: true}} dependencies:   - core/drupal   - core/drupalSettings  my-googlemaps.js:   console.log(Drupal.settings);   function initMap() {}   This way I get Drupal.settings undefined, which makes sense I guess. On the other hanve if I place initMap into a behavior It can not be seen as a callback as defined in googleapis.com before.  Has anyone stumbled with this before? Any idea how to attack the problem?
84571
I am having some difficulties to change "NULL" values to zero in geodatabase. I have tried the following python code in ArcGIS 10.1 ("Field Calculator") to change it but did not work.   Pre-Logic Script Code:  def RemoveNULL(x):     if x is None:         return ''     elif x == '':         return '0'     else: return x   Calculation field:  RemoveNULL(str( !DEAD_VOL_PER_HA_SPP1_125!))   Error message:  ERROR: 999999: Error executing function The value type is incompatible with the field type. [dead_pine] Failed to execute (calculate field)
61253
I have this MySQL query using  that is the following:  SELECT *  FROM data_tbl WHERE AES_DECRYPT(data_point,'aBcDeF')='data_1';   I've figured out as much that the equivalent in Postgres 11 is  (F.25.4. Raw Encryption Functions) and the query would look something like this:  SELECT *  FROM data_tbl AND decrypt(data_point,'aBcDeF','aes')='data_1';   At least, the documentation for both leads me to believe that these are equivalent.  The data was dumped from MySQL and imported into PostgreSQL.   The data-point field in MySQL is type varbinary(255) and the values all show BLOB in MySQL Workbench.  The data_point field in Postgres is type bytea and the values all show [binary data] in pgAdmin.    Whether those data types are equivalent, I admit, I'm not sure.  The MySQL query works and finds a record based on he criteria. The PostgreSQL does not, although the record is in there. So it seems like one of three things:   The data types (varbinary(255) vs bytea) are not equivalent The data does not match (BLOB vs [binary data]) are not equivalent The functions (AES_DECRYPT vs decrypt()) are not equivalent   I did try to decrypt the value in PostgreSQL just to see what it is in a readable format by first trying:  SELECT decrypt(data_point, 'aBcDeF', 'aes')  FROM data_tbl;   But that just returned [binary data] for all the rows.  Then I came across  to use convert_from as in:  SELECT convert_from(decrypt(data_point, 'aBcDeF', 'aes'), 'SQL_ASCII') FROM data_tbl;   However, I just get this error:  ERROR:  invalid byte sequence for encoding "UTF8": 0xcf 0xf5 SQL state: 22021   So at this point I'm stumped as to how to resolve the primary issue. The primary issue being doing the equivalent of AES_DECRYPT but in PostgreSQL 11. The last error message isn't so much an issue, but it is likely related to decrypt() not returning the same results.  Any suggestions?
91633
I have a shapefile and I loaded it into QGIS using Add vector layer. After that, I can see points in different positions. I open the Attribute table and I can see columns &quot;X&quot; and &quot;Y&quot; with values such as (151449.965057, 204642.790761). Now I want to convert them to latitude and longitude. How can I do that? Therefore, I use the option Save as to export the data to csv format using the CRS WGS 84. However, nothing changes in the CSV file (&quot;X&quot; and &quot;Y&quot; stay the same as the original data).  I read and tried several suggestions from this forum without help, e.g., .
101371
In QGIS I am trying to convert coordinates from a CSV file. QGIS can use another projection, but when I try to export this layer (and changing the output CRS) the coordinates in the CSV file itself won't change. Is there a way to transform/convert these coordinates and get the new values exported? Update of details: I have coordinates for points in a circle around a center point (geocoded from a service using WGS84).  These coordinates are in WGS84. I want these converted to SWEREF 99 TM, since that is what my other software is using. But when I import them, it looks like this:  I have use field calculator with on a CSV file and a SHP file, using this formula: x(transform($geometry,'EPSG:4326','EPSG:3006'))  The attribute form for the CSV file looks like this:  The formula seems to be working. The SHP file (exported from the CSV file) attribute form looks like this:  The formula is creating NULL values. Still, if I use the converted coordinates from the CSV file (export it to a new CSV file) Most likely there is some basic knowledge regarding coordinate transformation that I do not possess...
53926
How do i create a linestring from points sort by date in PostgreSQL?  I tried:  SELECT observations.id,    ST_MakeLine(observations.geom ORDER BY observations.date) AS newgeom    FROM   observations     GROUP BY    observations.id;   This is going wrong. It returns me a linestring with same coordinates.  So, instead of a line from a to b, it gives me a to a.    What am I doing wrong?
115029
I'm very new to GIS concepts. Is there a way or procedure of finding out whether the co-ordinate system is in UTM, latitude/longitude or in stateplane using .prj file?   My .prj file contains the following text:      GEOGCS["WGS 84",DATUM["WGS_1984",SPHEROID["WGS   84",6378137,298.257223563,AUTHORITY["EPSG","7030"]],AUTHORITY["EPSG","6326"]],PRIMEM["Greenwich",0,AUTHORITY["EPSG","8901"]],UNIT["degree",0.01745329251994328,AUTHORITY["EPSG","9122"]],AUTHORITY["EPSG","4326"]]
99466
We have some shapefile data and we have export to them to a MySQL table.   The table have these columns:  id name description fulladdress code lng lat ...   Now I wonder if it is possible to create a geocoding/reverse geocoding service based on these data?  If yes, what jobs will to be done?
11755
I have a problem with postgresql and QGIS :   I can add points/lines/polygons and fillup field   But I can't :   delete points/lines/polygons modify points/lines/polygons (move or modify field)   ex : dbname='Europe' host=localhost port=5432 user='postgres' sslmode=disable key='tid' estimatedmetadata=true srid=900913 type=Point table="public"."planet_osm_point" (way) sql=  QGIS is connected as admin level into database. With pdAdmin III I can do all (create, delete, modify...)  The postgresql database is imported from OSM with osm2pgsql.  On other layer, like .shp, I don't have this issue.  Any idea ?  Config : Ubuntu 14.04 / Posgresql 9.4 / QGIS 2.10
11691
I am trying to work with a shapefile using shapely, fiona and python. The original coordinate system is in latitude and longitude that I am trying to convert to state plane system. So I want an updated shapefile with coordinates as statePlane. I converted the json object:  fc = fiona.open("sample.shp")    geoJsonObj = shapefile_record['geometry'] array_coordinates = np.array(geoJsonObj['coordinates']) array_newCoordinates = copy.deepcopy(array_coordinates) for counter in range(0,len(array_coordinates[0])):     long,lat = p1(array_coordinates[0][counter][0],array_coordinates[0][counter][1])     #where p1 is a function to do the conversion     array_newCoordinates[0][counter][0] = long     array_newCoordinates[0][counter][1] = lat  geoJsonObj['coordinates'] = array_newCoordinates.tolist()   when i check the coordinates, i get state plane coordinates according to the transformation.  n. However, when i open the individual shapes/polygons within the shapefile, the coordinates are still latitude and longitude. why does this happen?  ----EDIT 1-----  from pyproj import Proj, transform import fiona from fiona.crs import from_epsg  dest_crs = from_epsg(4269) shape = fiona.open("Sample.shp") original = Proj(shape.crs) # EPSG:4326 in your case destination = Proj('+proj=lcc +lat_1=36.41666666666666 +lat_2=35.25      +lat_0=34.33333333333334 +lon_0=-86 +x_0=600000 +y_0=0 +ellps=GRS80 +datum=NAD83  +no_defs') with fiona.open('new.shp', 'w', 'ESRI Shapefile',shape.schema.copy(),crs = dest_crs) as output:     for feat in shape:                print feat['geometry']['coordinates']         for counter in range(0,len(feat['geometry']['coordinates'][0])):             long,lat =  feat['geometry']['coordinates'][0][counter]             x,y = transform(original, destination,long,lat)             feat['geometry']['coordinates'][0][counter] = (x,y)         output.write(feat)
123781
I've tried this a few different ways and keep getting the same error. I have a shapefile currently in WGS84 UTM Zone 15 which is SRID 32615.  I used the ArcMap multipart to singlepart tool to create a singlepart polygon. I followed the instructions found at  to install postgresql and postgis.  I open pgAdmin III and select the postgis_21_sample table. Plugins > PostGIS Shapefile and DBF Loader 21.  I check connection details and it connects fine.  I add my .shp file. I set Schema to public and Table to postgis_21_sample. I leave geo column alone and set SRID to 3265.  When I click import I get  ============================== Importing with configuration: postgis_21_sample, public, geom, C:\GIS\forest_buffer\postgres_single.shp, mode=c, dump=1, simple=0, geography=0, index=1, shape=1, srid=3265 Shapefile type: Polygon PostGIS type: MULTIPOLYGON[2] Failed SQL begins: "SET CLIENT_ENCODING TO UTF8; SET STANDARD_CONFORMING_STRINGS TO ON; BEGIN; CREATE TABLE "public"."postgis_21_sample" (gid serial, "shape_leng" numeric, "shape_area" numeric, "orig_fid" int4); ALTER TABLE "public"."postgis_21_sample" ADD PRIMARY KEY (gid);" Failed in pgui_exec(): ERROR:  function addgeometrycolumn(unknown, unknown, unknown, unknown, unknown, integer) does not exist LINE 9: SELECT AddGeometryColumn('public','postgis_21_sample','geom'...                ^ HINT:  No function matches the given name and argument types. You might need to add explicit type casts.  Shapefile import failed.   I've also tried projecting this shapefile to WGS84 with SRID 4326 and receive the same error.  There are >100,000 features and I need to buffer, dissolve, negative buffer, and finally buffer back to the original size to fill gaps.  ArcMap and QGIS fail to do it after days of waiting.
84460
I am having trouble with using GeoDataFrame.buffer function. That is probably because of my lack of understanding crs. Here is the case: I have events dataset (points longs &amp; lats) and locations dataset (points longs &amp; lats). I want to check which of the events occurred within 2km radius circle from locations. I know how to perform spatial join in geopandas, but the problem is in buffer(distance, resolution) function. When creating both GeoDataFrames I used crs: 'epsg:4326' and in distance parameter use 0.2 (without any good reason). So my question is: How to adjust crs and distance parameter to make it in kilometers? Here is my sample code. The intersection should contain only events with id 1 &amp; 2. However it does contain event 3 which is about 10km far from any of locations. Also it does not contain event with id 4, which is good, because that one is hundreds kilometers from any of locations. events = pd.DataFrame([     {'id': 1,      'longitude': 54.606402,      'latitude': 18.347709},     {'id': 2,      'longitude': 54.604681,      'latitude': 18.346534},     {'id': 3,      'longitude': 54.544322,      'latitude': 18.293896},     {'id': 4,      'longitude': 50.843233,      'latitude': 11.130688} ]) locations = pd.DataFrame([     {'id': 'a',      'longitude': 54.604972,      'latitude': 18.346815},     {'id': 'b',      'longitude': 54.605917,      'latitude': 18.347249} ])  locations_gpd = gpd.GeoDataFrame(locations,                                  geometry=gpd.points_from_xy(locations.longitude, locations.latitude).buffer(0.2, 16),                                  crs={'init': 'epsg:4326'})  events_gpd = gpd.GeoDataFrame(events,                               geometry=gpd.points_from_xy(events.longitude, events.latitude),                               crs={'init': 'epsg:4326'})  intersection = gpd.sjoin(locations_gpd, events_gpd, how='left')
57737
I have PostGIS table with two geometry columns, both defined with SRID 4326. I can insert into the table without problem, using the following INSERT statement (where lng and lat are values passed in programmatically):  INSERT INTO pad_meta (     uuid, created, updated, name, origin, radius, area, expiry, creator ) VALUES (     $1, now(), now(), $2, ST_GeomFromText('POINT(lng, lat)', 4326), $3,      ST_Buffer(ST_GeomFromText('POINT(lng, lat)', 4326), $4), $5, $6 )   But when i query for an intersection using ST_Intersects, depending on the value of the point I get ERROR: Operation on mixed SRID geometries.   For example, this query works:  SELECT * FROM pad_meta where ST_Intersects(     'POINT(-122.334172173172 46.602634395263560)'::geometry, area::geometry  ) ORDER BY created DESC;   And this errors out:  SELECT * FROM pad_meta where ST_Intersects(     'POINT(-122.334172173172 47.602634395263560)'::geometry, area::geometry  ) ORDER BY created DESC;   Note, they are identical queries except the value of the longitude. I have experimented with different values, but not identified a clear transition point between the queries that work and don't.   I think I am fundamentally misunderstanding something. For the moment, I have solved/corrected/worked around the problem by re-formatting the query to use ST_GeomFromText and explicitly specifying the SRID:  SELECT * FROM pad_meta where ST_Intersects(     ST_GeomFromText('POINT(-122.334172173172 47.602634395263560)', 4326), area ) ORDER BY created DESC;   But I honestly don't really understand what the difference is, or if this truly "the" solution.    Why am I getting an error only for specific values, and what is the proper way to format this query?  Here is my table definition for reference:  CREATE TABLE IF NOT EXISTS pad_meta (   uuid CHAR(32),   created TIMESTAMP,   updated TIMESTAMP,   name VARCHAR(128),   origin GEOMETRY(Point, 4326),   radius INTEGER,   area GEOMETRY(Polygon, 4326),   expiry TIMESTAMP,   creator CHAR(32),   PRIMARY KEY (uuid) );   I have also verified that there is only one type of SRID in the geometry_columns:   SELECT f_table_name, f_geometry_column, srid FROM geometry_columns; f_table_name | f_geometry_column | srid --------------+-------------------+------  pad_meta     | origin            | 4326  pad_meta     | area              | 4326   I have also seen , but since I am already explicitly defining my geometry SRIDs when inserting into the table, it seems like that is not what is happening.
114934
I have data that spreads across two UTM Zones GDA/MGA94 UTM Zone 55 and 56. I have layers such as a cadastre, roads, pipelines etc where I want to store measurements like lengths and areas in metres or some kind of metric notation, not degrees!  Whats the best way to manage this in PostGIS (i'm using PostGreSQL 8.4 PostGIS 1.5)?  Should I be storing my data as GDA94 Geographic coords and using some sort of work around to calculate the measurements I require?  Or is there another way to handle this?