Re: [gdal-dev] How to identify a point is belong to a polygon ?
Tai, You can use the spatial filter of the ogr layer to filter the point features to speed things up. You will still have to test if the point is within the polygon but it will be faster. Also, make sure the test is like point-Within(polygon) and not polygon-Within(point) OGRLayer::SetSpatialFilter() http://www.gdal.org/ogr/classOGRLayer.html#a0b4ab45cf97cbc470f0d60474d3e4169 On Fri, Jul 20, 2012 at 9:29 AM, Bui Chi Tai taibc_colt...@yahoo.comwrote: Chaitanya, I am checking my code. Maybe it is not successful because I used two different layers (of one file). As you know, one .dgn files only has one layer, that include many features, and Texts (Point Geometry), Polygons are treated as features. My idea is: First, I will read each feature to identify whether this feature is a polygon. Then, I need to use a loop to read and check all features of layer to identify whether a Text (point) is belong to that polygon. But, this will affect to the first reading times, and give unexpected result. Do you have any ideas ? Thanks and regards, Tai -- *From:* Chaitanya kumar CH chaitanya...@gmail.com *To:* Bui Chi Tai taibc_colt...@yahoo.com *Sent:* Friday, July 20, 2012 10:39 AM *Subject:* Re: [gdal-dev] How to identify a point is belong to a polygon ? Tai, I don't understand why it would happen. Can you provide some more details? Code, data? On Fri, Jul 20, 2012 at 9:05 AM, Bui Chi Tai taibc_colt...@yahoo.comwrote: Thanks Chaitanya, I am trying to use this method. But, it is not successful. For example: One file .dgn includes Text (treated as a point geometry) and Shapes (Polygon). I used the method OGRGeometry::Within(OGRGeometry * other) to identify whether the Text is belong to the polygon. But it doesn't return an expected result (Actually, there are some texts that belong to each polygon). Kind regards, Tai -- *From:* Chaitanya kumar CH chaitanya...@gmail.com *To:* taibc taibc_colt...@yahoo.com *Cc:* gdal-dev@lists.osgeo.org *Sent:* Friday, July 20, 2012 10:11 AM *Subject:* Re: [gdal-dev] How to identify a point is belong to a polygon ? Tai, You can use OGR_G_Within() OGR_G_WIthin(point,polygon) will return true if the point is within the polygon. You can access various other geometry functions from the OGRGeometry class. http://www.gdal.org/ogr/ogr__api_8h.html#a80ba9e516ccae381ae7240cc9684eb72 On Fri, Jul 20, 2012 at 7:04 AM, taibc taibc_colt...@yahoo.com wrote: Hi everyone, Do you know how to identify whether a point (OGRPoint) is belong to a polygon (OGRPolygon) ? (the polygon covers the point) Thanks and regards, Tai -- View this message in context: http://osgeo-org.1560.n6.nabble.com/How-to-identify-a-point-is-belong-to-a-polygon-tp4989501.html Sent from the GDAL - Dev mailing list archive at Nabble.comhttp://nabble.com/ . ___ gdal-dev mailing list gdal-dev@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/gdal-dev -- Best regards, Chaitanya kumar CH. +91-9494447584 17.2416N 80.1426E -- Best regards, Chaitanya kumar CH. +91-9494447584 17.2416N 80.1426E -- Best regards, Chaitanya kumar CH. +91-9494447584 17.2416N 80.1426E ___ gdal-dev mailing list gdal-dev@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/gdal-dev
Re: [gdal-dev] [OSGeo-Discuss] how to use gdal_calc.py?
We should have this discussion in the gdal-dev list. dhonjuh, Try this at the command prompt; not the python command prompt. $ gdal_calc.py -A cknp_dem_30m.tif --calc A/2 --outfile t.tif Also, make sure you did not make any inadvertent changes to the script. On Fri, Jul 20, 2012 at 2:00 PM, dhonjuh dhon...@yahoo.com wrote: thanks for your reply. I tried as you suggested but still I am getting syntax error like gdal_calc -A /cknp_dem_30m/.tif --calc A/2 --outfile t.tif SyntaxError: invalid syntax is there any lib missing? I hope. -- View this message in context: http://osgeo-org.1560.n6.nabble.com/how-to-use-gdal-calc-py-tp4989528p4989563.html Sent from the OSGeo Discuss mailing list archive at Nabble.com. ___ Discuss mailing list disc...@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/discuss -- Best regards, Chaitanya kumar CH. +91-9494447584 17.2416N 80.1426E ___ gdal-dev mailing list gdal-dev@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/gdal-dev
Re: [gdal-dev] New OGR driver to read OpenStreetMap .osm / .pbf files
Rahkonen Jukka Jukka.Rahkonen at mmmtike.fi writes: Even Rouault wrote: Do you have comparisons of the performance with osm2pgsql on the same PC and with the same data ? I'd be curious if that slow down effect is found with every tool, or if it is something specific to the way sqlite is used, or if other tools do more clever things when indexing or retrieving nodes. This test may be interesting. I took timings from converting finland.osm.pbf and germany.osm.pbf with spatialite_osm_map. It is doing roughly same thing as ogr2ogr, that is, reads nodes from OSM file and resolves point, line and polygon features. Enviroment: Windows 7, 64-bit. 6 GB memory 64-bit spatialite_osm_map.exe, version numbers: SQLite version: 3.7.13 SpatiaLite version: 3.1.0-RC2 Command: spatialite_osm_map -d osm_map_testfi.sqlite -o finland.osm.pbf -jo Results: Finland 11 minutes Germany 10 hours Memory usage of spatialite_osm_map process was very low, under 50 MB. Similar behaviour of ogr2ogr and spatialite_osm_map makes me think that perhaps it is SQLite that does not scale up well. -Jukka Rahkonen- ___ gdal-dev mailing list gdal-dev@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/gdal-dev
Re: [gdal-dev] Ogr: ExecuteSQL with MSSQL and geometry column
If you want I can remove the MemoryDriver, but it is still the same thing. [code] string request = SELECT * FROM MY_TABLE WHERE CHART_ID = 'Z15F43AJ'; Layer serverLayer = RclDataSource.ExecuteSQL(request, null, ); int nbFeature = serverLayer.GetFeatureCount(1); Feature serverFeature = serverLayer.GetNextFeature(); string[] namesColumnsArray = new string[3]; for (int i = 0; i serverFeature.GetFieldCount(); i++) namesColumnsArray[i] = serverFeature.GetFieldDefnRef(i).GetName(); Geometry serverGeometry = serverFeature.GetGeometryRef(); [/code] Results: nbFeature = 39 namesColumnsArray = { D , CHART_ID, WKB_GEOMETRY } serverGeometry = null For me the fact is that the result of the SQL request is a layer without geometry field, just 3 usuals fields. I suppose that is normal because if you ask for a request like : Select column_geo1, column_geo2 From Table1, Table2 Unless I am wrong, you can't have 2 geometrics fields in a layer. For me this result is normal (but I am a beginner with ogr so maybe not). Reminder : I just want fetch my geometry. In any cases, thank for all you reply Chaitanya_ch. Benjamin. chaitanya_ch wrote Benjamin, First thing: You don't need to use a memory datasource here. OGR doesn't make round trips to the database server every time you run GetNextFeature(). Do that first. I'm sure it will make it less complicated. I don't understand why you are getting the null. Hopefully we can figure that out after you simplify your code by removing the memory driver stuff. On Wed, Jul 18, 2012 at 8:52 PM, Benjamin LUX lt;Benjamin.lux@gt;wrote: Hi again Chaitanya, ** ** If you look my previous mail you can see the code. But in a compact way this is a copy/paste of my running code. Note that RoleEnvironment.GetConfigurationSettingValue(“”) just provide me parametrables strings (like argv[n]). [code] Ogr.RegisterAll(); string option = String.Format( Tables=dbo.{0}(WKB_GEOMETRY);GeometryFormat=wkb;, RoleEnvironment.GetConfigurationSettingValue( CatalogueRclAllName) ); RclDataSource = Ogr.Open(String.Format(MSSQL:{0}{1}, RoleEnvironment .GetConfigurationSettingValue(DataBaseConnectionString), option), 0);*** * string request = String.Format(SELECT * FROM {0} WHERE CHART_ID = '{1}' , RoleEnvironment.GetConfigurationSettingValue(CatalogueRclAllName), Z15F43AJ); ** ** Layer serverLayer = RclDataSource.ExecuteSQL(request, null, ); ** ** Driver memDriver = Ogr.GetDriverByName(Memory); DataSource memDataSource = memDriver.CreateDataSource(GetWorkPath( nomimprobale), null); Layer memLayer = memDataSource.CopyLayer(serverLayer, serverLayer.GetName(), null); Feature memFeature = memLayer.GetNextFeature(); string[] namesColumnsArray = new string[5]; for (int i = 0; i memFeature.GetFieldCount(); i++) namesColumnsArray[i] = memFeature.GetFieldDefnRef(i).GetName(); Geometry memGeometry = memFeature.GetGeometryRef(); [/code] ** ** Results : namesColumnsArray = { D , CHART_ID, WKB_GEOMETRY } memGeometry = null ** ** I don’t see what I can add to this :/ If you want more details said me. ** ** Link to the thread : http://osgeo-org.1560.n6.nabble.com/gdal-dev-Ogr-ExecuteSQL-with-MSSQL-and-geometry-column-tp4988831.html ** ** Best regards, Benjamin ** ** *De :* Chaitanya kumar CH [mailto:chaitanya.ch@] *Envoyé :* mercredi 18 juillet 2012 16:53 *À :* Benjamin LUX *Cc :* gdal dev *Objet :* Re: Ogr: ExecuteSQL with MSSQL and geometry column ** ** Hi Benjamin, Can you provide some more details? How did you try to retrieve the geometry? On Wed, Jul 18, 2012 at 8:02 PM, lt;benjamin.lux@gt; wrote: Benjamin wrote memFeature.GetGeometryRef(); // return null Sorry, but no. After a call to SQLExecute(), Ogr framwork doesn't recognize any geometry in my feature. If you have a clue why that ? chaitanya_ch wrote Benjamin, The mssql driver already does the conversion from wkb in the database to the native ogr geometry format. You don't have to create a temporary wkb geometry and then the ogr geometry. You can simply do this: [code] Geometry memGeom = memFeature.GetGeometryRef() [/code] On Wed, Jul 18, 2012 at 6:31 PM, Benjamin lt;benjamin.lux@gt; wrote: Sorry, I was not clear. I resume from the beginning. I work with a warper C# of Ogr. I have a table dbo.MY_TABLE with 3 fields (D, CHART_ID, WKB_GEOMETRY) in a SQL server Database (in SQL Azure exactly). *My aim is to work with a copy* (in a http://www.gdal.org/ogr/drv_memory.html Memory DataSource ) of a SQL statement result executed on a MSSQL DataSource. Actually I can work with usuals methods with this MSSQL DataSource. Note that I have not geometry_column table
[gdal-dev] geotransform rotation and gdal_merge
I'm attempting to put aircraft scan data into geotiffs (1-3 scanlines each) and then use gdal_merge.py to combine them into one large geotiff that has the entire aircraft's path. The scan lines are 15 pixels wide and taken every 10 seconds, the geotiffs are wgs84 lat/lon, and I have lat/lon values for each pixel. To handle the case when the aircraft isn't flying straight north I think I have to use the 2 rotation parameters in the affine geotransform, is that right? I don't have any test cases, but I think if I don't use rotation anything that reads the geotiff will think that the image is square(aligned) in lat/lon space. Whether or not I need to use this, can someone explain to me how to use the rotation coefficients? What are the actual values of the coefficients supposed to be? I couldn't find a good example and I couldn't get any basic situations to make sense, like a 2x3 array turned 45 degrees. I used these equations: Xgeo = GT(0) + Xpixel*GT(1) + Yline*GT(2) Ygeo = GT(3) + Xpixel*GT(4) + Yline*GT(5) And lastly, does gdal_merge.py handle rotation? I checked the source and it doesn't ever seem to use elements 2 and 4 in its calculations. Thanks for any help. -Dave ___ gdal-dev mailing list gdal-dev@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/gdal-dev
Re: [gdal-dev] Memory leaks when using SQL queries with shapefiles
Le vendredi 13 juillet 2012 16:22:34, Pierluigi Guasqui a écrit : Even, I opened a ticket in GDAL Trac: http://trac.osgeo.org/gdal/ticket/4749. Confirmed and fixed now. Thanks for reporting. ___ gdal-dev mailing list gdal-dev@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/gdal-dev
Re: [gdal-dev] Problem reading shapefile via /vsizip
Le vendredi 13 juillet 2012 12:40:34, Smith, Michael ERDC-CRREL-NH a écrit : Ticket created http://trac.osgeo.org/gdal/ticket/4748 Confirmed and fixed now. Thanks for reporting ___ gdal-dev mailing list gdal-dev@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/gdal-dev
Re: [gdal-dev] New OGR driver to read OpenStreetMap .osm / .pbf files
However, select with SQL feels sub-optimal. Yes, when you use ogr2ogr with explicit layer names, there are optimizations. For example, when you only specify the layer 'points', the OSM driver will not even try to index the nodes into the temporary database because it is not needed. However, as you noticed, there is not yet any optimization when a SQL request is specified. Optimization for SQL request added in r24690 ___ gdal-dev mailing list gdal-dev@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/gdal-dev