Hi pierre:
I have not solve the problem,to improve the speed of function ST_WorldToRasterCoord() function . so accodording to your advice, To make the query faster you could simply do the math yourself without
> relying on the ST_WorldToRasterCoord() function. We do the math by ourselves. Here comes the procedure.
1) draw an enveloping rectangle to contain the polygon of a certain city. Get the coordinates of the 4 point of the enveloping rectangle. They are the (minX,maxY) , (maxX,maxY), (minx,minY), (maxX,minY).
2) Transfer the point (maxX,maxY) into a point object int the space, via the function: (st_geomfromtext('POINT('|| maxx ||' '|| maxy ||')',4326), in this function we get the point Geographic Coordinate System.
3)Convert the Geographic Coordinate System into the XI’AN 84 Coordinate System.( which is a geodetic coordinate system ) via the function:
(st_transform(st_geomfromtext('POINT('|| maxx ||' '|| maxy ||')',4326),2382)
3)Transfer the point (minX,maxY) into a point object int the space .
4) Calculate the distance between thepoint(maxX,maxY)and the point(minX,maxY) via the function :
st_distance(st_transform(st_geomfromtext('POINT('|| maxx ||' '|| maxy ||')',4326),2382), st_transform(st_geomfromtext('POINT('|| minx ||' '|| maxy ||')',4326),2382)). The unit of result is Meter.
5)Suppose the size of the raster is 100 meters. We can find out width of the raster.
According to the same method, we can also find out the height of the raster.
6) Now we can do a maths method like the ST_WorldToRasterCoord() function . the SQL language looks like the fllows:
update sample set (x,y) =
(
round(((longitude-minx)/width)*b.x+0.5),
round(((maxy-latitude)/height)*b.y+0.5)
)from city_xy b where b.name = city and sample.x is null;--get x y
update sample set geom = st_geomfromtext('point('||longitude||' '||latitude||')',4326)
where geom is null;--创建点对象
Although we have solve th problem, yet it is a great pity,we use the function of geometry, not the function of the raster. How I hope , there will be a plan to improve the function ST_WorldToRasterCoord() function . what is more could you please forword the mail to the author of the function ST_WorldToRasterCoord(), I will write more on my suggestion on that function. That is really a very important function in our project.
Lastly,I still can not understand the idea, One way to improve everything is to tile the raster into small tiles (10x10) and to index them while loading the raster into the database. So far as I know, we can add index to the GEOM object via the GIST index, yet I still do not know how can we add index to the raster object. Hope you coluld show me an example.
Recently we have a lot of projects on the geom and raster intersection, I have already known the power of postgis geom. Object, yet I still do not find the approach to manage the raster object in a more efficeny way, for example to add index to the raster, how you will guide us in this area.
zhanying
分享到:
相关推荐
The attached code shows how to locate files in a directory using the FileSystemObject. You can search just within the specified directory or include all subdirectories in the search.
A way to locate Cortex-M hard fault
使用assembly插件打包jar后启动时,总是出现Unable to locate Spring NamespaceHandler for XML schema....错误,网上找了各种方法都没有用,在尝试了100+失败后,解决了这个问题,在打包的jar中,META-INF目录下,...
from hyperspectral images provides a new way to locate potential targets in a scene, especially those targets that are spectrally different from the majority of the data set. Conventional Mahalanobis-...
Although From Hacking to Report Writing will give you the technical know-how needed to carry out advanced security tests, it also offers insight into crafting professional looking reports describing ...
In Lesson 1 you learn how to organize columns and rows of data into a range so that you can effectively sort, filter, subtotal, and outline the data. Then you learn how to protect the data from ...
I totally reworked the NT Service app sample application into a 100% functional application that shows you how to replicate a portion of a table into a separate database and how to put a full text ...
Chapter 9, Using a GPS Receiver to Locate Your Robot, shows you how to use a GPS receiver so that your robot will know its location since your robot may get lost if it is mobile. Chapter 10, System ...
How to locate web elements and test functions for hyperlinks, buttons, TextFields and TextAreas, radio buttons, CheckBoxes, and more How to use Selenium WebDriver for select lists, navigation, ...
Understanding network latency and how to locate the source. How common network attacks are seen by an intrusion detection systems. Techniques for investigating security alerts using packet data. How ...
selenium+firefox在定位时遇到selenium.common.exceptions.NoSuchElementException: Message: Unable to locate element: 由于是js加载页面,想确认是否是js的原因,随后进行多次调试时发现“//div”竟然也出现了...
pycharm调试openerp
Spark在windows运行报错-ERROR Shell Failed to locate the winutils binary in the hadoop binary path java.io-附件资源
linux gcc install 很全的linux gcc 安装,对离线安装gcc很有帮助...
<END><br>56,LocFiles.zip The attached code shows how to locate files in a directory using the FileSystemObject. You can search just within the specified directory or include all subdirectories in ...
It starts by showing you how to locate and measure problems and then shows you how to solve some of the most common ones. Next, it shows you how to get started with ASP.NET Core 2 on Windows, Mac, ...
A feature-based approach to visual/IR sensor image registra- tion is presented.This new method overcomes the difficulties caused by the discrepancy in data’s gray-scale characteristics and the ...
Before we look at how SQL Server uses and manages its memory, we need to ensure a full understanding of the more common memory related terms. The following definitions will help you understand how SQL...
You’ll learn how to locate performance bottlenecks and significantly speed up your code in high-data-volume programs. How can you take advantage of multi-core architectures or clusters? Or build a ...
and in an acquired image but also to provide information on how to locate additional artifacts that may be of interest. My primary reason for writing this book has been so that I can give back to a ...