使用OpenMap API这类做的我用来提取点的数据的要素?
-
03-10-2019 - |
题
我目前使用的要素类和ColdFusion去通过的"记录"的各个要素.每个记录具有一个边界框我能得到这种信息,但是还没有找到一种方式来实际检索点内每个记录。
有人可以阐明这类使用和如何使用它们?
这是完全相同的情况(包括一些verbage)为:
http://old.nabble.com/what-class-do-you-use-to-extract-data-from-.SHP-files--td20208204.html
人我使用ColdFusion,我认为,任何暗示的解决方案将会帮我很大。
我的电流试验的代码如下:
<cfset shapeFile = createObject("java","com.bbn.openmap.layer.shape.ShapeFile")>
<cfset shapeFile.init('/www/_Dev/tl_2009_25_place.shp')>
<cfoutput>
getFileLength = #shapeFile.getFileLength()#<br>
getFileVersion = #shapeFile.getFileVersion()#<br>
getShapeType = #shapeFile.getShapeType()#<br>
toString = #shapeFile.toString()#<br>
</cfoutput>
<cfdump var="#shapeFile#">
<cfdump var="#shapeFile.getBoundingBox()#"> <br>
<cfdump var="#shapeFile.getNextRecord()#">
解决方案
我从来没有使用这个或做任何地理信息系统,但后看API,这是我的建议。
因此,在您有您的要素,你会:
myESRIRecord = shapeFile.getNextRecord();
这可以让你一个 ESRIRecord 类或一个子类,这取决于哪种类型的形状。
的要素,我已经搞砸了图这是:
http://russnelson.com/india.zip
且仅包含 多边形 类型。
该ESRIPolygonRecord包含财产称为"多边形",其中包含一系列com.非曲直.openmap。层。形状。ESRIPoly$ESRIFloatPoly实例。
关键用这个图书馆,它似乎是一个很大的数据是在特性,不能通过方法。
因此,正如我所说,ESRIPolygonRecords有的数据在多边形财产,ESRIPointRecord有的数据在x和y的性质。所以,如果你是在寻找一个getX()或杰蒂(),这就是为什么你没有找到它。
这样品代码为我工作:
<cfset shapeFile = createObject("java","com.bbn.openmap.layer.shape.ShapeFile")>
<cfset shapeFile.init('/tmp/india-12-05.shp')>
<!--- There may be more then one record, so you can repeat this, or loop to get
more records --->
<cfset myRecord = shapeFile.getNextRecord()>
<!--- Get the polygons that make up this record --->
<cfset foo = myRecord.polygons>
<cfdump var="#foo#">
<cfloop array="#foo#" index="thispoly">
<cfoutput>
This poly has #thisPoly.nPoints# points:<br>
<!--- because java arrays are 0 based --->
<cfset loopEnd = thisPoly.nPoints-1>
<cfloop from="0" to="#loopEnd#" index="i">
X: #thisPoly.getX(i)# Y: #thisPoly.getY(i)#<br>
</cfloop>
<!--- Returns points as array --->
<cfdump var="#thisPoly.getDecimalDegrees()#">
<cfdump var="#thisPoly.getRadians()#">
</cfoutput>
</cfloop>
不隶属于 StackOverflow