求建筑物的高度

#include <stdio.h>
int main(void)
{
	float x,y;
	printf("Input:\n请输入坐标: ");
	scanf("%f %f",&x,&y);
	printf("Output:\n该点建筑物的高度: ");
	if(x>=1&&x<=3||x>=-3&&x<=-1)
	{
		if(y>=1&&y<=3||y>=-3&&y<=-1)
		{
			printf("10.00");
		}else{
			printf("0.00");
		}
	}
	printf("\n");
	return 0;
}

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
在OSM中,只有少数建筑物高度信息。因此,如果您需要包含建筑物高度建筑物信息表,您需要使用其他数据源,例如Lidar数据或航空摄影数据。您可以使用这些数据源创建自己的高度信息表,并将其与OSM数据合并。这可以通过使用Python库如geopandas和pandas来实现。以下是一个简单的例子: 首先,您需要下载Lidar数据或航空摄影数据,并将其转换为高度信息表。您可以使用Python库如PDAL和laspy来实现。以下是一个示例代码: ```python import pdal import laspy import numpy as np import pandas as pd pipeline = [ { "type": "readers.las", "filename": "path/to/lidar/data.las" }, { "type": "filters.range", "limits": "Classification[2:2]" }, { "type": "filters.ferry", "dimensions": "X,Y,Z", "value": "Classification", "mode": "greater" }, { "type": "writers.text", "format": "csv", "filename": "path/to/output.csv" } ] result = pdal.pipeline(pipeline) data = pd.read_csv("path/to/output.csv", usecols=["X", "Y", "Z"]) data.to_csv("path/to/output.csv", index=False) ``` 这个代码将读取Lidar数据,并仅保留分类为2(表示建筑物)的点。然后,它使用ferry filter将点的高度值从Classification字段中提取到Z字段中。最后,它将结果保存为CSV文件。 接下来,您需要将高度信息表与OSM数据合并。以下是一个示例代码: ```python import osmnx as ox import pandas as pd import geopandas as gpd # download OSM data place_name = "New York, New York, USA" graph = ox.graph_from_place(place_name) # extract building footprints from OSM data buildings = ox.footprints.footprints_from_place(place_name) # read height information from CSV file heights = pd.read_csv("path/to/heights.csv", usecols=["X", "Y", "Z"]) # convert height information to GeoDataFrame geometry = gpd.points_from_xy(heights["X"], heights["Y"]) heights_gdf = gpd.GeoDataFrame(heights, geometry=geometry) # spatial join OSM building footprints with height information buildings_with_heights = gpd.sjoin(buildings, heights_gdf, op="contains") # merge height information with OSM data graph_with_heights = ox.buildings.merge_building_heights(graph, buildings_with_heights) # save graph with height information ox.save_graphml(graph_with_heights, "path/to/graph_with_heights.graphml") ``` 这个代码将下载OSM数据并提取建筑物轮廓。然后,它将高度信息读入Pandas DataFrame中,并将其转换为GeoDataFrame。接下来,它使用空间连接将建筑物轮廓与高度信息表连接起来。最后,它将高度信息与OSM数据合并,并保存带有高度信息的图形。您现在可以使用OSMnx绘制带有建筑物高度的地图。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值